<input>
The purpose this test is to show the cascade order of how accessible names are applied in the accessibility tree. This example should not be considered proper practice. Where possible the contents of the <label>
should be used to define the accessible name.
The input element can be given an accessible name using the following methods, in order of priority:
aria-labelledby
aria-label
<label>
with for
title
placeholder
aria-placeholder
The <input>
element should have an accessible name of ‘Cat’ via the aria-labelledby
attribute.
The <input>
element should have an accessible name of ‘Dog’ via the aria-label
attribute.
The <input>
element should have an accessible name of ‘Fish’ via the <label>
element.
The <input>
element should have an accessible name of ‘Rabbit’ via the title
attribute.
The <input>
element should have an accessible name of ‘Fox’ via the placeholder
attribute.