Coder Social home page Coder Social logo

Comments (7)

ljharb avatar ljharb commented on May 8, 2024

i'm not sure why a button needs a label, but yes, the button would need an ID, and the label would need to enclose the button and have an htmlFor that points to it.

from eslint-plugin-jsx-a11y.

kevinSuttle avatar kevinSuttle commented on May 8, 2024

Use case: A button would need a label if say, there were only an icon.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 8, 2024

Why wouldn't you just make it not only be an icon? Icons should always have accompanying text, and ideally inside the clickable region since small target areas are problematic for, say, people with arthritis.

from eslint-plugin-jsx-a11y.

kevinSuttle avatar kevinSuttle commented on May 8, 2024

Because it still needs button behavior. It's getting a title via aria-labelled-by, and the icon's title is in the SVG along with the graphics.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 8, 2024

So the title is impossible-to-translate image-based text? O.o

from eslint-plugin-jsx-a11y.

kevinSuttle avatar kevinSuttle commented on May 8, 2024

What? No.

https://egghead.io/lessons/css-accessible-icon-buttons

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 8, 2024

Right - so typical users won't see any text, just an icon. That doesn't seem very UX-friendly to me :-/

Either way, I'd expect the label to wrap the button, not the other way around.

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.