| Summary: | Dialog's "previously focused element" and focus-visible | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Darin Senneff <darin.senneff> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | koivisto, ntim, rego, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Mac (Intel) | ||
| OS: | macOS 12 | ||
| Bug Depends on: | |||
| Bug Blocks: | 84635 | ||
|
Description
Darin Senneff
2022-02-08 12:48:20 PST
Hi, thanks for the bug report. If you're testing this on Mac, <button> are not mouse focusable on Mac (see https://bugs.webkit.org/show_bug.cgi?id=229895 for more details). So I guess that when you close the dialog, if it was opened by a button, it's not going to be focused when you close it. I've tested on WebKitGTK (Linux), and the button that opens the dialog gets focused when I close it. If the problem is unrelated to the buttons not being click focusable on Mac, could you please create a test case reproducing the issue? Yup, I get the non-focusable button if the <dialog> is opened and closed with a mouse. And that if its opened and closed with a keyboard that the button does get focus. But what if the <dialog> is opened with a mouse but closed with a keyboard? Since the element autofocuses a button upon opening (and can be closed with the ESC key), it's likely that some users will switch to a keyboard after originally opening the <dialog> with their mouse/finger. In those cases, doesn't it make sense to put keyboard focus to the button? |