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

🐛 lint/a11y/noAutofocus contradicts with MDN recommendations for <dialog> #4339

Open
1 task done
andy128k opened this issue Oct 19, 2024 · 1 comment
Open
1 task done
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@andy128k
Copy link

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

A lint/a11y/noAutofocus contradicts with MDN recommendations for :

The autofocus attribute should be added to the element the user is expected to interact with immediately upon opening a modal dialog. If no other element involves more immediate interaction, it is recommended to add autofocus to the close button inside the dialog, or the dialog itself if the user is expected to click/activate it to dismiss.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog

Code example

Expected result

It should permit autoFocus when it is used inside a dialog.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@andy128k andy128k added the S-Needs triage Status: this issue needs to be triaged label Oct 19, 2024
@ematipico ematipico added S-Help-wanted Status: you're familiar with the code base and want to help the project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Oct 23, 2024
@github-actions github-actions bot removed S-Needs triage Status: this issue needs to be triaged labels Oct 23, 2024
@ematipico
Copy link
Member

autoFocus should be valid also for elements that use the attribute popover.

Once we fix the issue, we should update the rule to be inspired and provide examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

No branches or pull requests

2 participants