Code Monkey home page Code Monkey logo

Comments (7)

julianna-langston avatar julianna-langston commented on June 7, 2024 2

The Legend example shouldn't conflict with removing the role from the parent.

I've opened a PR for the change.

from recharts.

julianna-langston avatar julianna-langston commented on June 7, 2024 1

Both aria-label and aria-labelledby get passed along to the SVG element. However, that SVG element is wrapped in the <div role="region">, which never receives those extra attributes.

Note that the SVG element itself already has a role attribute, and it seems like it will always be the same role as the .recharts-wrapper. My preference is just to remove the role from the .recharts-wrapper container element. I believe having 2 identical nested roles is unnecessary, and the SVG element is already receiving the relevant aria labelling attributes.

@ckifer Is there a time when the .recharts-wrapper has multiple SVG elements nested inside of it? If so, can you point me to one of those examples? Otherwise, what are your thoughts on removing that role?

Anyway, @nermin97, I hope it's easy for you to re-run the scans that are giving you that error. The error message looks like aXe/Deque to me, but I wasn't able to reproduce the error using Lighthouse (which sort of uses aXe). Since I don't know what tool you used for the scan, I'm not sure what will actually get you a clean scan. These options are your best bet for clearing the error today:

  • Use the accessibilityLayer prop. This will assign a role of application (and make your chart tooltips accessible to keyboard-only and screen reader users). For example: <LineChart data={myData} accessibilityLayer>
  • Overwrite the role to something else, like "none". role="none effectively tells the screen reader that the content is just a pile of text (which, without accessibilityLayer, is true). For example: <LineChart data={myData} role="none">.

from recharts.

nermin97 avatar nermin97 commented on June 7, 2024 1

Thanks for the help.

from recharts.

ckifer avatar ckifer commented on June 7, 2024

@julianna-langston thoughts?

from recharts.

ckifer avatar ckifer commented on June 7, 2024

@julianna-langston thanks for the detailed reply!

These are the usages of Surface which is where tags originate from

It looks like two SVGs are rendered in a chart with a Legend that uses DefaultLegendContent
Inspecting this example reveals that https://master--63da8268a0da9970db6992aa.chromatic.com/?path=/story/examples-barchart--stacked

Otherwise, only 1 <svg> per chart from what I can see

from recharts.

ckifer avatar ckifer commented on June 7, 2024

cherry-picked your commit into master as well. This should be out next patch

from recharts.

ckifer avatar ckifer commented on June 7, 2024

released in 2.12.4

from recharts.

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.