GithubHelp home page GithubHelp logo

Comments (8)

beefancohen avatar beefancohen commented on May 18, 2024 1

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.

beefancohen avatar beefancohen commented on May 18, 2024

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.

lencioni avatar lencioni commented on May 18, 2024

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.

beefancohen avatar beefancohen commented on May 18, 2024

Ah, great. Google's implicit role definition is here.

So the logic goes

  1. Arrive at aria-* attribute node
  2. 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.

lencioni avatar lencioni commented on May 18, 2024

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.

lencioni avatar lencioni commented on May 18, 2024

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.

beefancohen avatar beefancohen commented on May 18, 2024

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.

lencioni avatar lencioni commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.