Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation of FocusOptions.focusVisible. #34875

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Jul 16, 2024

Description

focusVisible: false is not equivalent to not specifying the option as the current text implies.

The spec is clear, and only indicates focus if focusVisible is true, or not specified and a browser-heuristic matches, see 1:

If the value of the focusVisible dictionary member of options is
true, or is not present but in an implementation-defined way the
user agent determines it would be best to do so, then indicate focus.

That condition doesn't match if the member is present and is false :)

Motivation

It's wrong. There seems to be confusion in issues like w3c/csswg-drafts#5885, partially due to the wrong MDN documentation.

Additional details

I wrote the spec (see whatwg/html#8087), and this was explicitly discussed in the WHATWG in the various meetings referenced from whatwg/html#7830 :)

`focusVisible: false` is not equivalent to not specifying the option as
the current text implies.

The spec is clear, and only indicates focus if focusVisible is true, or
not specified and a browser-heuristic matches, see [1]:

> If the value of the `focusVisible` dictionary member of options is
> `true`, or is not present but in an implementation-defined way the
> user agent determines it would be best to do so, then indicate focus.

That condition doesn't match if the member is present and is `false` :)

[1]: https://html.spec.whatwg.org/#dom-focus
@emilio emilio requested a review from a team as a code owner July 16, 2024 21:55
@emilio emilio requested review from wbamberg and removed request for a team July 16, 2024 21:55
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Jul 16, 2024
Copy link
Contributor

Preview URLs

@sideshowbarker sideshowbarker merged commit 1ca8335 into mdn:main Jul 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants