[Webkit-unassigned] [Bug 229895] New: Clicking button drops focus entirely
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 3 14:05:36 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=229895
Bug ID: 229895
Summary: Clicking button drops focus entirely
Product: WebKit
Version: Safari 14
Hardware: Mac (Apple Silicon)
OS: macOS 11
Status: NEW
Severity: Normal
Priority: P2
Component: Forms
Assignee: webkit-unassigned at lists.webkit.org
Reporter: andy.blum.01 at gmail.com
CC: cdumez at apple.com, wenson_hsieh at apple.com
Spin off issue from #22261 (https://bugs.webkit.org/show_bug.cgi?id=22261#c82)
In that issue, the maintainers assert:
> 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.
That does not appear to happen in Safari. 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)
After clickign the button, where is the focus? The tabbing order is maintained, but the focus leaves both the input and button. document.activeElement is the page's body, but I'm pretty sure that's the default when the focusoutEvent.relatedTarget == null.
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.
--
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/ac2890c5/attachment-0001.htm>
More information about the webkit-unassigned
mailing list