Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<b-collapse> Accordion causes page to scroll #5715

Closed
Hiws opened this issue Sep 1, 2020 · 1 comment
Closed

<b-collapse> Accordion causes page to scroll #5715

Hiws opened this issue Sep 1, 2020 · 1 comment

Comments

@Hiws
Copy link
Member

Hiws commented Sep 1, 2020

Describe the bug

Since Chromium 84, the page scrolls with the toggle button of an accordion (might be other scenarios), because the browser tries to keep the button in the same position in the viewport.

This has been fixed in Bootstrap 4.5.1 via this PR: twbs/bootstrap#31347
However, because Bootstrap-Vue doesn't follow the same structure for accordions it doesn't apply here.

The fix is to add the style overflow-anchor: none to either the toggle button or a parent of the button.

We could solve this by adding a overflow-anchor-none and overflow-anchor-visible utility classes, and have overflow-anchor-none applied by default via v-b-toggle, and for users toggling accordion's another way could still utilize the helper class to turn off the behavior if they want.

Maybe have a setting to decide whether v-b-toggle should turn off this behavior or not.

Steps to reproduce the bug

  1. Go to https://bootstrap-vue.org/docs/components/collapse#accordion-support
  2. Open a accordion under an accordion which is already open
  3. The browser should scroll the window up, keeping the clicked button in the same position in the viewport

Versions

Libraries:

  • BootstrapVue: 2.16.0
  • Bootstrap: 4.5.2
  • Vue: 2.6.11

Environment:

  • OS: Windows
  • Browser: Chromium (Chrome, Edge..)
  • Version: 84+
@jacobmllr95
Copy link
Member

@Hiws Another option would be to introduce a <b-accordion> helper component that renders a element (tag defaults to div) which has the accordion class and role="tablist" applied.

The helper component could also provide bvAccordion data which we could inject into the <b-collapse> component to set the accordion prop automatically when detected.

@jacobmllr95 jacobmllr95 moved this from To do to In progress in v2.17.0 Sep 13, 2020
v2.17.0 automation moved this from In progress to Done Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v2.17.0
  
Done
Development

No branches or pull requests

2 participants