Open Bug 1750959 Opened 2 years ago Updated 2 years ago

Tabbing buttons in an overflowed container doesn't align the button with the bottom of the container.

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

Webcompat Priority P3

People

(Reporter: karlcow, Unassigned)

References

()

Details

Attachments

(2 files)

(Initially reported by Gooz)

Steps to Reproduce
Tab your way through the buttons until you reach button 3

Expected
Bottom of button 3 aligns with bottom of the container

Actual
Button 3 stays in place and doesn't align with container (while subsequent tabbing aligns the bottom of the buttons with the container)

On both Blink and Webkit, button 3 bottom gets aligned with the bottom of the scrollable context of the container. Note that on Safari you first need to activate navigation by tabulation with System Preferences > Keyboard > Shortcuts > Use keyboard navigation to move focus between controls

Safari WebKit top (Release 137 (Safari 15.4, WebKit 17613.1.11.8))
Firefox Gecko middle (98.0a1 (2022-01-18) (64-bit))
Edge Blink bottom (Version 99.0.1139.0)

This code uses WhenToScroll::IfNotVisible so this seems to be sorta intentional to some extent. We could try to change it to IfNotFullyVisible, or do something more complex, but we should check what other browsers do in similar cases...

Component: Layout: Form Controls → DOM: UI Events & Focus Handling

Finally, I reached bug 372665. Smaug, did you have intention of using "if not visible" except avoiding the crash?

Flags: needinfo?(bugs)
Severity: -- → S3

Are you talking about nsHTMLAnchorElement::SetFocus?
My guess is that I changed that to be consistent with nsGenericElement::SetFocus.
Though, the test isn't using any <a> elements.
But obviously that was long ago so I don't remember. Did that patch actually change the behavior here?

Flags: needinfo?(bugs)

(In reply to Olli Pettay [:smaug] from comment #5)

Are you talking about nsHTMLAnchorElement::SetFocus?

Oh, I'm sorry, I might have been confused. According to attachment 382498 [details] [diff] [review] (nsFocusManager creation), nsHTMLButtonElement::SetFocus used nsGenericHTMLElement::Focus. And nsGenericHTMLElement::Focus still used NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE. So I need to check the history of nsGenericHTMLElement::Focus more.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: