RESOLVED FIXED 217240
REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
https://bugs.webkit.org/show_bug.cgi?id=217240
Summary REGRESSION (r257839): Broken focus when 'display' changes in an attribute sel...
Ali Juma
Reported 2020-10-02 11:14:01 PDT
Created attachment 410344 [details] Test case This is similar to bug 216754 and bug 216257 but still broken after those fixes. The conditions needed for this bug are: 1) An element E is display:none because of an attribute selector 2) Script asks for E's computed style's display property 3) The attribute from the attribute selector changes so that E is now display:block 4) Some descendant D of E is focused using D.focus() After r257839, we end up using the stale computed style stored at step (2) when checking for hidden ancestors in Element::isVisibleWithoutResolvingFullStyle(), so incorrectly conclude that D is not visible. I've attached a test case. In practice, this is happening on m.youtube.com in Chrome for iOS, where tapping on the search button will fail to focus the search field. In that case, the code asking for the computed style is actually in Chrome's injected logic for autofill and translation. However, the attached test case reproduces the bug more generally (in MiniBrowser and Safari).
Attachments
Test case (936 bytes, text/html)
2020-10-02 11:14 PDT, Ali Juma
no flags
patch (4.83 KB, patch)
2021-01-12 03:45 PST, Antti Koivisto
no flags
patch (5.53 KB, patch)
2021-01-13 04:26 PST, Antti Koivisto
no flags
alternative (6.26 KB, patch)
2021-01-13 06:07 PST, Antti Koivisto
ews-feeder: commit-queue-
Radar WebKit Bug Importer
Comment 1 2020-10-02 12:15:12 PDT
Antti Koivisto
Comment 2 2021-01-12 03:05:32 PST
Attribute change invalidation fails to invalidate the computed style.
Antti Koivisto
Comment 3 2021-01-12 03:45:44 PST
Antti Koivisto
Comment 4 2021-01-13 04:26:29 PST
Antti Koivisto
Comment 5 2021-01-13 05:30:44 PST
*** Bug 220580 has been marked as a duplicate of this bug. ***
Antti Koivisto
Comment 6 2021-01-13 06:07:54 PST
Created attachment 417527 [details] alternative
Antti Koivisto
Comment 7 2021-01-13 11:08:27 PST
Speedometer A/B looks good.
EWS
Comment 8 2021-01-13 11:20:48 PST
Committed r271446: <https://trac.webkit.org/changeset/271446> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417524 [details].
Note You need to log in before you can comment on or make changes to this bug.