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

💅 Error no-noninteractive-element-to-interactive-role in svg #1095

Closed
1 task done
RoyMcCrain opened this issue Dec 7, 2023 · 4 comments · Fixed by #1381
Closed
1 task done

💅 Error no-noninteractive-element-to-interactive-role in svg #1095

RoyMcCrain opened this issue Dec 7, 2023 · 4 comments · Fixed by #1381
Assignees
Labels
A-Documentation Area: documentation A-Linter Area: linter good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@RoyMcCrain
Copy link

Environment information

CLI:
  Version:                      1.4.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.18.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "bun/1.0.15"

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

Workspace:
  Open Documents:               0

Rule name

noInteractiveElementToNoninteractiveRole

Playground link

https://biomejs.dev/playground/?code=PABkAGkAdgA%2BAAoAIAAgADwAaAAyAD4AUgBvAGwAZQAgAG4AbwBuAGUAPAAvAGgAMgA%2BAAoAIAAgAAoAIAAgADwAcwB2AGcAPgAKACAAIAAgACAAPAB0AGkAdABsAGUAPgBwAGEAcwBzADwALwB0AGkAdABsAGUAPgAKACAAIAA8AC8AcwB2AGcAPgAKACAAIAAKACAAIAA8AGgAMgA%2BAEEAZABkACAAcgBvAGwAZQAgAGkAbQBnADwALwBoADIAPgAKACAAIAA8AHMAdgBnACAAcgBvAGwAZQA9ACIAaQBtAGcAIgA%2BAAoAIAAgACAAIAA8AHQAaQB0AGwAZQA%2BAHAAYQBzAHMAPAAvAHQAaQB0AGwAZQA%2BAAoAIAAgADwALwBzAHYAZwA%2BAAoACgAgACAACgA8AC8AZABpAHYAPgA%3D

Expected result

role="img" is passed in svg.
The noInteractiveElementToNoninteractiveRole description does not include svg.
However, specifying a role for svg results in an error for this rule.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

ematipico commented Dec 7, 2023

The diagnostic is correct (I just checked if <svg> is interactive, and it's not), but the documentation is not exhaustive. Mainly because we copied from the original rule.

Fix: to add svg to the list of non-interactive roles.

@ematipico ematipico added good first issue Good for newcomers A-Linter Area: linter A-Documentation Area: documentation S-Bug-confirmed Status: report has been confirmed as a valid bug labels Dec 7, 2023
@RoyMcCrain
Copy link
Author

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/img_role#svg_and_roleimg
I thought it was a bug because it was recommended to add role="img" to the SVG as shown above.
Thanks for confirming.

@ematipico
Copy link
Member

That's interesting 🤔

@chansuke
Copy link
Member

I'd like to work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Documentation Area: documentation A-Linter Area: linter good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants