Bug 216418 - visibility: hidden does not remove focus
Summary: visibility: hidden does not remove focus
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: Mac Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-11 13:30 PDT by Tim Guan-tin Chien [:timdream]
Modified: 2020-09-25 16:31 PDT (History)
5 users (show)

See Also:


Attachments
testcase (1.11 KB, text/html)
2020-09-11 13:30 PDT, Tim Guan-tin Chien [:timdream]
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Guan-tin Chien [:timdream] 2020-09-11 13:30:32 PDT
Created attachment 408558 [details]
testcase

STR:

See test case, the page will

0. check the current focused element by looking at `document.activeElement`.
1. focus() the element
2. set visibility: hidden on the element
3. wait for 100ms
4. check the current focused element by looking at `document.activeElement` again.

Expected:

On Chrome on step 4, the focused element is the body

Actual:

On Safari and Firefox, the focused element is still the element.

Note:

1. The inconsistency suggests that there may be a spec issue here.
2. On Chrome sometime a micro task is enough for the focus to moved away, some times it is not.
Comment 1 Radar WebKit Bug Importer 2020-09-11 13:30:53 PDT
<rdar://problem/68728487>
Comment 2 Darin Adler 2020-09-12 12:44:38 PDT
Any change here should wait on the resolution of https://github.com/w3c/uievents/issues/236
Comment 3 Darin Adler 2020-09-12 12:46:01 PDT
Bug 29241 is the same issue, but with "display: none" rather than "visibility: hidden".