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

[Dialog] Page is scrolled to top when opening the dialog if html { scroll-behavior: smooth } #1340

Open
benface opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1343
Open

[Dialog] Page is scrolled to top when opening the dialog if html { scroll-behavior: smooth } #1340

benface opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1343
Assignees
Labels
bug 🐛 Something doesn't work

Comments

@benface
Copy link

benface commented Jan 16, 2025

Bug report

Current behavior

Super weird one, but like the title says! I can reproduce in Chrome and Safari; it works fine in Firefox.

Expected behavior

The page should not be scrolled to the top when the dialog opens.

Reproducible example

https://codesandbox.io/p/sandbox/competent-chandrasekhar-8wcv88

Base UI version

1.0.0-alpha.5

Which browser are you using?

Chrome 132.0.6834.84, Safari 18.2

Which OS are you using?

macOS

Which assistive tech are you using (if applicable)?

None

Additional context

Thank you 🙏

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 16, 2025
@atomiks
Copy link
Contributor

atomiks commented Jan 16, 2025

It seems the scroll lock needs to unset the scroll-behavior style inline.

This fixes it as a workaround:

  html:not([data-base-ui-scroll-locked]) {
    scroll-behavior: smooth;
  }

@atomiks atomiks added bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 16, 2025
@atomiks atomiks linked a pull request Jan 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants