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

Clarify note about keyboard-activated click events #36256

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

benignant
Copy link
Contributor

Description

Update the wording of the note to make it clear that it only refers to keyboard clicks.

Motivation

Additional details

Related issues and pull requests

#35458

@benignant benignant requested a review from a team as a code owner October 8, 2024 00:11
@benignant benignant requested review from wbamberg and removed request for a team October 8, 2024 00:11
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Oct 8, 2024
Copy link
Contributor

github-actions bot commented Oct 8, 2024

Preview URLs

External URLs (1)

URL: /en-US/docs/Web/API/Element/click_event
Title: Element: click event

@wbamberg
Copy link
Collaborator

wbamberg commented Oct 8, 2024

Thanks for the PR! A couple of things:

This is supposed to be about the third bullet only, right? Reading the preview page, that wasn't at all obvious to me (it was only reading the history of this bug that I understood it). Even indenting the note isn't going to help much, because it's in a new block, so it still won't obviously be glued to the third bullet. I think it would be better all round to not have a note here and add this as a new sentence to the bullet, like:

  • Any user interaction that is equivalent to a click occurs, such as pressing the Space key or Enter key while the element is focused. Note that in practice browsers don't fire the click event for custom controls (such as a <div> with tabindex="0") when activated by keyboard. To check the reason behind this behavior, see this Chromium issue.

However, the wording still talks about this as if it is a web compat issue (i.e. a de facto deviation from the spec) but this comment: https://issues.chromium.org/issues/40776466#comment18 suggests that the behavior is per spec. So could we try something like:

  • Any user interaction that is equivalent to a click occurs, such as pressing the Space key or Enter key while the element is focused. Note that this only applies for elements with a default key event handler, and therefore excludes elements such as <div> elements with tabindex="0".

I don't love it but I also didn't like "custom controls" which I didn't really understand (makes me think of web components).

Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Josh-Cena Josh-Cena merged commit f284719 into mdn:main Oct 8, 2024
7 checks passed
@Josh-Cena
Copy link
Member

Josh-Cena commented Oct 8, 2024

Oooops! I merged this before I see @wbamberg's comment. @wbamberg I like your suggestion and I wonder if you can make yet another PR to change it😅 Sorry for the extra work caused

@wbamberg
Copy link
Collaborator

wbamberg commented Oct 8, 2024

No worries, @Josh-Cena :)

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.

3 participants