Comments (8)
Built out AX_ARIA_11 today. I like all of these proposals. I'm thinking about maybe implementing all of them within the week and publishing v1.0.0
from eslint-plugin-jsx-a11y.
Does this rule mean that role has to be defined for these aria-* properties to be valid? I.E. can you use aria-posinset
without role being defined?
<li aria-posinset="16" />
from eslint-plugin-jsx-a11y.
My hunch was that your example should not warn, but I found conflicting answers on stack overflow:
Based on this information, I'd say that li
has a default role and this rule should not warn.
Furthermore, it looks like the code for the rule I linked in my OP, calls a getRoles
utility method with an argument that allows implicit semantics to be considered if there is no role attribute.
This seems like enough evidence to me to allow implicit semantics in the eslint rule.
from eslint-plugin-jsx-a11y.
Ah, great. Google's implicit role definition is here.
So the logic goes
- Arrive at aria-* attribute node
- Check the element that contains this attribute for an explicit role, then implicit role.
- If role is defined, enforce rule accordingly.
- If role is undefined and there is implicit definition, enforce rule accordingly.
- If role is undefined and there is no implicit definition, then pass or fail?
I'm thinking in the last case, that we don't warn - we can assume an element without an explicit and implicit role can handle the global properties set (all aria-*
properties).
from eslint-plugin-jsx-a11y.
I'm not sure about not warning if there is no role and no implicit definition. It seems that if there is no explicit role and no implicit definition, then we would actually want to warn.
from eslint-plugin-jsx-a11y.
Some of the constants in this file might be useful: https://github.com/GoogleChrome/accessibility-developer-tools/blob/e70dd633a25e8a8c659a587f7ce58b923db1eef2/src/js/Constants.js#L1108
It defines the implicit roles for elements, and appears to define lists of allowed roles for each element as well (which might make another good rule here).
from eslint-plugin-jsx-a11y.
Thanks! That's what I've been using as my main reference for outlining attributes across, roles, aria, and DOM elements.
In the third case, if I'm following this code correctly, it seems that they are applying the global set of aria-*
properties to an undefined role.
from eslint-plugin-jsx-a11y.
Ah, interesting. That does seem to be coded that way. However there is that note about it ignoring some problems. I suppose it's not a bad place to start--we can always make it more strict in the future as the plugin is refined.
from eslint-plugin-jsx-a11y.
Related Issues (20)
- Changelog links broken due to different repo HOT 1
- jsx-a11y/label-has-associated-control gives error when for is put HOT 3
- label-has-associated-control regression
- How to configure `eslint-plugin-jsx-a11y` in `eslint.config.js` HOT 5
- [label-has-associated-control] regression - rule errors when a label does not directly have text, even if it has htmlFor HOT 8
- jsx-a11y/control-has-associated-label triggers on TD element HOT 1
- Coordinate NodeJS version support with axe-core HOT 9
- [img-redundant-alt] `words` option does not work with double-byte character words.
- `alt-text`: missing warning for empty `alt` for `<input type="image" alt="" />`
- [label-has-associated-control] Glob format not supporting labelComponents HOT 1
- Snyk: MPL 2.0 license vulnerability in axe-core HOT 2
- anchor-has-content and aria-labelledby
- Lint error on valid way for associating a `label` to an `input` control HOT 1
- `jsx-a11y/label-has-associated-control` behavior is apparently misdocumented HOT 10
- Add support for ESLint 9 HOT 3
- heading-has-content false positive for object spread HOT 1
- [control-has-associated-label]: Does not allow for custom components that would result in accessible labels HOT 1
- `jsx-a11y/media-has-caption` Eslint Warning for Missing Captions in Media Elements HOT 1
- bug: type declaration for eslint flat config HOT 3
- Rule Idea: Enforce boolean literals for "booleanish" HTML attributes such as aria-hidden HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-jsx-a11y.