Accessibility ... in web development means enabling as many people as possible to use websites, even when those people's abilities are limited in some way.
People's abilities can vary situationally
tab
to go to the next form field(whether disabled or not)
Use tools that enforce their use.
Time dedicated to using our products in specific ways.
An additional layer of semantics
role="presentation"
or aria-hidden="true"
on a focusable element.Rule 1
Don't do this:
<div role="button" onClick="handleClick">Click me! I'm a button!</div>
Do this instead
<button onClick="handleClick">Click me! I'm ataully a button!</button>
Rule 2
Don't do this:
<h2 role=tab>heading tab</h2>
Do this instead
<div role=tab>
<h2>heading tab</h2>
</div>
Rule 3
Don't do this:
<div role="button" onClick={handleClick}>Click me!</div>
Do this instead
<div
role="button"
onClick={handleClick}
onKeyDown={handleKeyDown}
tabindex="0"
>
Click me!
</div>
role="presentation"
or aria-hidden="true"
on a focusable elementDon't do this:
<button role=presentation>press me</button>
<button aria-hidden="true">press me</button>
Do this instead
button {opacity:0}
<button tabindex="-1" aria-hidden="true">press me</button>
button {display: none}
<button>press me</button>
Rule 4
Don't do this:
<span>user name</span> <input type="text">
Do this instead
<label>
<span>user name</span>
<input type="text">
</label>
<span>user name</span> <input type="text" aria-label="user name">
<span id="input-name">user name</span> <input type="text" aria-labeledby="input-name">
Rule 5
Introducing the Accessibility tab in Dev Tools
withIn
cy.findByRole('region', { name: 'Support'}).withIn(() => {
cy.findByRole('link', { name: 'use semantic HTML elements' });
})
<input
aria-labelledby="labelShutdown shutdownTime shutdownUnit"
type="checkbox"
>
<span id="labelShutdown">Shut down computer after</span>
<input
aria-labelledby="labelShutdown shutdownTime shutdownUnit"
id="shutdownTime"
type="text"
value="10"
>
<span id="shutdownUnit"> minutes</span>
cy.findByRole('link', { name: 'Click me!' })
<a href="http://aumni.fund">Click me!</a>
accessible name
role