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 doesn't scroll autofocused element into view on open #2213

Open
claviska opened this issue Oct 9, 2024 Discussed in #2199 · 0 comments
Open

Dialog doesn't scroll autofocused element into view on open #2213

claviska opened this issue Oct 9, 2024 Discussed in #2199 · 0 comments
Labels
bug Things that aren't working right in the library.

Comments

@claviska
Copy link
Member

claviska commented Oct 9, 2024

Discussed in #2199

Originally posted by ourson66 October 1, 2024
Hi!

A few months back I asked about an issue I was seeing, where I had an sl-dialog which had enough items in it to gain an internal scroller. The first field in the dialog is set to "autofocus" as outlined on the website, and as expected, when the dialog is opened, that field has the focus. Here's a codePen: https://codepen.io/ourson66/full/poYJLKK

Using that pen, click the "Open" button and the dialog will open. The first field should be focused and ready to go. Great!

Now scroll down through the fields until the focused field is not visible at the top of the display. Manually click on one of the fields you have visible now (Field 18 for example). Then click the "X" at the top of the dialog to close it.

Click the "Open" button again, to re-open the dialog. Notice how the scroller has not changed, however, if you scroll to the top, you'll see the first field again has focus. This is the issue I was talking about. When a field gains focus, it should be automatically scrolled into view, especially if that gain of focus happens because of an autofocus when a dialog is opened.

I noticed that this was marked as "closed" in a previous build, and I'm not sure if this represents a regression, but I'm using the latest 2.17.0 in the codePen, and it doesn't appear to be fixed... Any help would be greatly appreciated!


Related: #693

@claviska claviska added the bug Things that aren't working right in the library. label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

1 participant