Bug 220243

Summary: [selectors] :focus should match inside the focus event
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: CSSAssignee: Manuel Rego Casasnovas <rego>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, esprehn+autocc, ews-watchlist, fred.wang, kangil.han, svillar, webkit-bug-importer, youennf
Priority: P2 Keywords: BrowserCompat, InRadar, WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=523126
Bug Depends on:    
Bug Blocks: 220312    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Manuel Rego Casasnovas
Reported 2021-01-04 08:32:33 PST
The specs seem clear about the expected behavior for this: - From https://drafts.csswg.org/selectors-4/#the-focus-pseudo: "The :focus pseudo-class applies while an element has the focus" - From https://w3c.github.io/uievents/#event-type-focus: "The focus MUST be given to the element before the dispatch of this event type" Also Chromium and Firefox already does this.
Attachments
Patch (4.73 KB, patch)
2021-01-04 08:35 PST, Manuel Rego Casasnovas
no flags
Patch (6.62 KB, patch)
2021-01-04 08:48 PST, Manuel Rego Casasnovas
no flags
Patch (10.72 KB, patch)
2021-01-04 14:29 PST, Manuel Rego Casasnovas
no flags
Patch (10.98 KB, patch)
2021-01-05 02:00 PST, Manuel Rego Casasnovas
no flags
Patch (11.08 KB, patch)
2021-01-05 04:27 PST, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2021-01-04 08:35:56 PST
EWS Watchlist
Comment 2 2021-01-04 08:36:50 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Manuel Rego Casasnovas
Comment 3 2021-01-04 08:48:21 PST
(In reply to EWS Watchlist from comment #2) > This patch modifies the imported WPT tests. Please ensure that any changes > on the tests (not coming from a WPT import) are exported to WPT. Please see > https://trac.webkit.org/wiki/WPTExportProcess The test is not yet in WPT, but it's going to be there before merging this change in WebKit. The test was originally a Chromium internal test and it's being moved upstream in the following Chromium patch: https://chromium-review.googlesource.com/c/chromium/src/+/2610084
Manuel Rego Casasnovas
Comment 4 2021-01-04 08:48:50 PST
Sergio Villar Senin
Comment 5 2021-01-04 09:42:16 PST
The patch seems correct but it's causing failures in several tests so please do address them.
Manuel Rego Casasnovas
Comment 6 2021-01-04 14:29:26 PST
Manuel Rego Casasnovas
Comment 7 2021-01-04 21:37:52 PST
The WPT test has been already merged upstream, and the EWSs are green now.
Manuel Rego Casasnovas
Comment 8 2021-01-05 02:00:22 PST
Frédéric Wang (:fredw)
Comment 9 2021-01-05 04:12:00 PST
Comment on attachment 416977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416977&action=review LGTM, but I'd rather tweak the WPT tests first and reimport all in preliminary patch. > Source/WebCore/ChangeLog:9 > + The specs seem clear about the expected behavior for this: nit: s/is/seem/ ? > Source/WebCore/ChangeLog:15 > + A similar fix has been done on Blink in r201118 by <kochi@chromium.org>. maybe add a reference to https://src.chromium.org/viewvc/blink?revision=201118&view=revision ? > LayoutTests/ChangeLog:11 > + and these tests will be re-imported and unskipped in a follow-up patch. Maybe it would be better to import all sync changes in a preliminary patch, and then just changes the expectation in this patch. > LayoutTests/imported/w3c/ChangeLog:11 > + - focus-visible-005.html now fails, but it was passing because it was checking anything due to this bug. was not > LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-in-focus-event-001-expected.txt:3 > +PASS Checks that ':focus' pseudo-class matches inside 'focus' evente handler event handler > LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-in-focus-event-001.html:17 > + }, "Checks that ':focus' pseudo-class matches inside 'focus' evente handler"); event handler
Manuel Rego Casasnovas
Comment 10 2021-01-05 04:26:36 PST
(In reply to Frédéric Wang (:fredw) from comment #9) > Comment on attachment 416977 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416977&action=review > > LGTM, but I'd rather tweak the WPT tests first and reimport all in > preliminary patch. Thanks for the review, I believe I prefer the current order, as the modified tests won't do anything useful without this patch. And this patch is about fixing a clear issue with its own WPT test, so I prefer not to mix it too much with the :focus-visible tests, skipping them sounds fine so far as we don't have any implementation. And also I already have the patch in the related but to update them. > > > Source/WebCore/ChangeLog:9 > > + The specs seem clear about the expected behavior for this: > > nit: s/is/seem/ ? Fixed. > > > Source/WebCore/ChangeLog:15 > > + A similar fix has been done on Blink in r201118 by <kochi@chromium.org>. > > maybe add a reference to > https://src.chromium.org/viewvc/blink?revision=201118&view=revision ? Done. > > > LayoutTests/ChangeLog:11 > > + and these tests will be re-imported and unskipped in a follow-up patch. > > Maybe it would be better to import all sync changes in a preliminary patch, > and then just changes the expectation in this patch. As mentioned earlier, I'll do it the other way around. > > > LayoutTests/imported/w3c/ChangeLog:11 > > + - focus-visible-005.html now fails, but it was passing because it was checking anything due to this bug. > > was not Nice catch, fixed too. > > > LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-in-focus-event-001-expected.txt:3 > > +PASS Checks that ':focus' pseudo-class matches inside 'focus' evente handler > > event handler Ack. > > > LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-in-focus-event-001.html:17 > > + }, "Checks that ':focus' pseudo-class matches inside 'focus' evente handler"); > > event handler Fixed upstream: https://github.com/web-platform-tests/wpt/pull/27042
Manuel Rego Casasnovas
Comment 11 2021-01-05 04:27:55 PST
EWS
Comment 12 2021-01-05 05:40:20 PST
Committed r271146: <https://trac.webkit.org/changeset/271146> All reviewed patches have been landed. Closing bug and clearing flags on attachment 416990 [details].
Radar WebKit Bug Importer
Comment 13 2021-01-05 05:41:15 PST
Note You need to log in before you can comment on or make changes to this bug.