Szemantikus HTML és hozzáférhető nevek
Jelentést hordozó natív HTML-lel teszi érthetővé a szerkezetet, vezérlőket és állapotokat segítő technológiának.
semantic-html-accessible-names
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha képernyőolvasó névtelen vezérlőt vagy zavaros szerkezetet mond.
Miben segít neked?
- Natív gombot, hivatkozást, űrlapcímkét és oldalterületet választ.
- A hozzáférhető nevet összhangban tartja a látható szöveggel.
- Valós tiltott, kinyitott és kijelölt állapotot közöl.
Például ezt kérheted
Vizsgáld az ikonos műveleteket és mezőket értelmes névvel, helyesen felolvasott állapottal. Vizsgálj csak ikonos törlőgombot és nyitható szűrőt. Az akadálymentes név írja le a műveletet, a nyitott állapot egyezzen a valódi panellel.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Semantic HTML & Accessible Names
Assistive technologies rely on the browser's accessibility tree — computed from HTML elements, attributes and ARIA — to convey role, accessible name, state/value and document structure (WCAG 4.1.2, 1.3.1, 2.4.6, 2.5.3). Always start from native HTML elements before reaching for ARIA.
1. Native HTML First vs. Custom Elements
- First Rule of ARIA: if a native HTML element or attribute provides the semantics and keyboard behavior you need, use it directly (
<button type="button">,<a href="...">,<input>,<select>,<textarea>,<dialog>,<details>/<summary>,<table>,<fieldset>/<legend>). - Button vs. Link:
- Use
<a href="...">for navigation that changes the URL or moves to a document/section. An<a>without anhrefis not keyboard-focusable. - Use
<button type="button">for in-page actions (opening a dialog, toggling state, submitting/deleting, sorting a table column, triggering a menu).
- Use
- Never attach click handlers to bare
<div>,<span>or<svg>without a native interactive element or full role,tabindex="0",Enter/Spacekeyboard handling and state synchronization.
2. Landmarks, Document Regions & Heading Hierarchy
Screen reader users navigate pages by jumping across landmarks and headings:
- Page landmarks: structure views with
<header>(banner),<nav>(navigation),<main>(main, one visible per view),<aside>(complementary) and<footer>(contentinfo). - Disambiguate multiple landmarks of the same type: give multiple
<nav>or<section>/<aside>landmarks distinct accessible names viaaria-labeloraria-labelledby(without repeating"navigation"insidearia-label). - Logical heading outline (
<h1>–<h6>): provide a clear<h1>for the current view and nest<h2>–<h6>by logical containment rather than visual font size.
3. Accessible Name Computation & Label in Name
Follow the W3C Accessible Name and Description Computation priority order:
aria-labelledby(overrides all other name sources — references space-separated IDs, even if hidden).aria-label(overrides visible text content inside the element).- Native host-language association (
<label for="...">,<legend>for<fieldset>,<caption>for<table>,altfor<img>, subtree text for<button>/<a>). - Fallback attributes (
titleorplaceholder— fragile, never use as primary label).
Critical Naming Rules
- WCAG 2.5.3 Label in Name: when a control has a visible text label, its accessible name must contain the visible text string (ideally starting with it) so voice-control users saying "Click Save changes" can activate it. Never put
aria-label="Submit form"on a button whose visible text saysSave changes. - Icon-only controls: give every icon-only button or link a concise
aria-label(or visually hidden text), witharia-hidden="true" focusable="false"on the inner<svg>. - Repeating row/card actions: in lists or tables with repeated buttons (
Edit,Delete), disambiguate viaaria-label="Edit invoice #1042"oraria-labelledbycombining the action and row identifier.
4. Honest States & Properties
- Synchronize states in real time:
aria-expanded="true|false"on disclosures/menus,aria-pressed="true|false"on toggles,aria-selected="true|false"on tabs/options,aria-current="page|step"on active nav items, anddisabled/aria-disabled="true"when unavailable. - Never leave dangling IDs in
aria-labelledby,aria-describedby,aria-controlsoraria-ownswhen targets unmount.
Csomagban lévő fájlok 1
SKILL.md
