Autofocus Not Scrolling Field into View in <sl-dialog>
with Internal Scroller
#2205
Labels
bug
Things that aren't working right in the library.
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!
The text was updated successfully, but these errors were encountered: