Closed Bug 1695284 Opened 1 year ago Closed 1 year ago

[wpt-sync] Sync PR 27806 - [selectors] Add tests related to script focus and :focus-visible

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 27806 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/27806
Details from upstream follow.

b'Manuel Rego Casasnovas <rego@igalia.com>' wrote:

[selectors] Add tests related to script focus and :focus-visible

These are a set of tests trying to see what should happen with :focus-visible in different scenarios when there's a programmatic focus.

This is an attempt to have a common understanding in order to be able to write some spec text, probably based on the last proposal on the CSSWG issue where this was discussed. Even when the spec text might end up going to HTML spec instead of selectors' one, as suggested by the CSSWG.

TBH I don't have a clear opinion on which cases should match or not, but I think it's more useful for me to have a good set of tests and agree on them, in order to prepare a potential spec text (and also to know what to implement on the WebKit side, as this particular topic was brought up during the review of the patch to add support for `:focus-visible). I'll be fine changing these tests so some of them match and other not, or whatever is needed. Even add more cases if you think it's useful.

This PR has 19 tests, all of them but 1 are repeated. So for each pair of tests (2 & 3, or 4 & 5, etc) the 1st one does focus() and the 2nd one does blur() and then focus(). I believe we want both cases to behave the same always.

Here is the list of tests and the pass/fail in Chromium and Firefox:
| Test | Title | Chromium | Firefox |
|---|---|---|---|
| focus-visible-script-focus-001.html | Script focus without any previous user interaction matches :focus-visible | PASS | PASS |
| focus-visible-script-focus-002.html | Script focus after mouse click does NOT match :focus-visible<br>This checks script focus after the user has clicked something irrelevant on the page. | FAIL | FAIL |
| focus-visible-script-focus-003.html | Script focus after blur after mouse click does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-004.html | Script focus after keyboard input does NOT match :focus-visible<br>This checks script focus after the user has typed a random letter without focusing anything on the page. | FAIL | FAIL |
| focus-visible-script-focus-005.html | Script focus after blur after keyboard input does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-006.html | Script focus after mouse click on a NOT focusable element does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-007.html | Script focus after blur after mouse click on a NOT focusable element does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-008.html | Script focus after mouse click on a focusable element that does not match :focus-visible, does NOT match :focus-visible | PASS | PASS |
| focus-visible-script-focus-009.html | Script focus after blur after mouse click on a focusable element that does not match :focus-visible, does NOT match :focus-visible | PASS | FAIL |
| focus-visible-script-focus-010.html | Script focus after mouse click on a focusable element that matches :focus-visible, does match :focus-visible | FAIL | PASS |
| focus-visible-script-focus-011.html | Script focus after blur after mouse click on a focusable element matches :focus-visible, does match :focus-visible | FAIL | PASS |
| focus-visible-script-focus-012.html | Script focus after keyboard focus does match :focus-visible | PASS | PASS |
| focus-visible-script-focus-013.html | Script focus after blur after keyboard focus does match :focus-visible | PASS | PASS |
| focus-visible-script-focus-014.html | Script focus after keyboard input does match :focus-visible | PASS | PASS |
| focus-visible-script-focus-015.html | Script focus after blur after keyboard input does match :focus-visible | PASS | PASS |
| focus-visible-script-focus-016.html | Script focus after mouse click on a NOT focusable element after editing an input does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-017.html | Script focus after blur after mouse click on a NOT focusable element after editing an input does NOT match :focus-visible | FAIL | FAIL |
| focus-visible-script-focus-018.html | Script focus after mouse click on a focusable element after editing an input does NOT match :focus-visible | PASS | PASS |
| focus-visible-script-focus-019.html | Script focus after blur after mouse click on a focusable element after editing an input does NOT match :focus-visible | PASS | FAIL |

Sorry for the long list and thank you very much for your time. I hope this will allow us to move the topic forward.

CC @alice @emilio @bkardell

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 15 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 19 tests and 2 subtests

Status Summary

Firefox

OK : 19
PASS: 38

Chrome

OK : 19
PASS: 38

Safari

OK : 19
FAIL: 38

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/489ebe9ddd3c
[wpt PR 27806] - [selectors] Add tests related to script focus and :focus-visible, a=testonly
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
You need to log in before you can comment on or make changes to this bug.