Botones con iconos que aún tienen nombre
Asigne una etiqueta accesible y clara a un botón sin texto.
Botones con iconos que aún tienen nombre es una lección gratuita de Web Accessibility Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Web Accessibility Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Web Accessibility Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
The Silent Button Problem
A button with only an icon inside looks clear to the eye, but a screen reader may just say button with no clue what it does. 🔇
Every Control Needs a Name
Every interactive control must have an accessible name. For text buttons the text supplies it; an icon-only button has no text to borrow.
Add aria-label to the Button
The simplest fix: put aria-label on the button itself to name the action, even when the inside is just an icon.
<button aria-label="Close">
<svg aria-hidden="true">...</svg>
</button>Hide the Icon Inside
Mark the inner icon with aria-hidden="true". The button carries the name; the icon is pure decoration once the label exists.
<button aria-label="Search">
<svg aria-hidden="true" focusable="false">...</svg>
</button>Or Use Visually Hidden Text
Prefer real text? Add a span styled with a visually-hidden class. Sighted users see only the icon; screen readers hear the words.
<button>
<svg aria-hidden="true">...</svg>
<span class="sr-only">Add to cart</span>
</button>What sr-only CSS Looks Like
A visually-hidden class clips the text to a single pixel without using display none, which would also hide it from screen readers.
.sr-only {
position: absolute;
width: 1px; height: 1px;
clip-path: inset(50%);
}Name the Action, Not the Icon
Label what happens, not the picture. Use Delete, not trash can. Users want the verb, not a description of the glyph.
Never Use the title Attribute Alone
The HTML title attribute is unreliable as a name: it skips touch and keyboard users entirely. Use aria-label or hidden text instead.
Toggle Buttons Need State
For an icon toggle like mute, also add aria-pressed so the button announces whether it is currently on or off.
<button aria-label="Mute" aria-pressed="false">
<svg aria-hidden="true">...</svg>
</button>Keep the Name in Sync
If an icon button changes meaning, update its name too. A play button that became pause must now announce Pause, not Play.
Verify the Spoken Name
In the accessibility inspector, select the button and read its computed name. It should match the action, never be blank.
Quick Check
You have a button containing only a magnifier SVG and no text. How do you give it an accessible name?
Recap: Name Every Icon Button
Give icon-only buttons a name via aria-label or visually hidden text, hide the icon, and label the action. Now every button speaks. ✅
Preguntas frecuentes
¿La lección «Botones con iconos que aún tienen nombre» es gratis?
Sí — el texto completo de «Botones con iconos que aún tienen nombre» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Web Accessibility Academy, actualiza a CoddyKit PRO. El curso de Web Accessibility Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Botones con iconos que aún tienen nombre»?
Asigne una etiqueta accesible y clara a un botón sin texto. Practicas Web Accessibility Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Web Accessibility Academy?
No se requiere experiencia previa. Web Accessibility Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.
¿Cuánto tiempo toma la lección «Botones con iconos que aún tienen nombre»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Web Accessibility Academy?
Sí. Cada lección de Web Accessibility Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- SVG en línea: role img y un title
- Ocultar iconos decorativos con aria-hidden
- Botones con iconos que aún tienen nombre
- Fuentes de iconos y sus problemas de accesibilidad