[Webkit-unassigned] [Bug 22261] Clicking on a non-text input element does not give it focus

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 3 13:52:42 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=22261

Andy Blum <andy.blum.01 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andy.blum.01 at gmail.com

--- Comment #81 from Andy Blum <andy.blum.01 at gmail.com> ---
Hi there! Sorry to stir up old discussions, but I think there's got to be some sort of better behavior that safari could do than the status quo.

The main issue I have here is with this assertion:

> Mac users expect the focus to remain in the text field if you click on a button. That’s what happens everywhere else on their computer in all the Mac applications. It’s a benefit that buttons work as expected, consistent with other buttons on the Mac, and don't pull the focus away from the text field you are already typing in.

If this were the standard behavior and that clicking a button didn't pull focus from the item that currently had it - well, I could live with that. But that's not what happens in Safari.

Interacting with a button in safari drops focus entirely. It's not left on the previously focused element, it doesn't go to button, nothing gets focus. Focus just ceases to exist.

I've made a codepen to hopefully illustrate my point: https://codepen.io/andy-blum/pen/ExXgxWO

Clicking into a text input raises the following events:
- mousedown 
- focus
- focusin
- mouseup
- click

Then, clicking into a directly adjacent button:
- mousedown (button)
- blur      (input)
- focusout  (input)
- mouseup   (button)
- click     (button)

So... where is the focus? The tabbing order is maintained, but the focus leaves both the input and button.

The reason I came across this bug recently was an issue for a search component listening for focusout events to close the type-ahead suggestions. Clicking the search button on this form closes the results and interrupts the submission of the form because the entire component loses focus before the button can even be clicked.

I understand the arguments of intention presented here, but the implementation
in Safari simply does not align with those intentions and breaks intuitive behavior web developers anticipate and experience in other browsers - regardless of OS.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210903/fb6d0633/attachment-0001.htm>


More information about the webkit-unassigned mailing list