Test Page: .ariaLabel DOM Property
Accessibility problems exist when return values for .ariaLabel
are "undefined" or return a type that is not the same on every browser. Developers assume that DOM properties for ARIA roles, properties and states are consistent between browsers, and when they are not that causes accessibility problems.
Setting Code | Return value of .ariaLabel |
---|---|
<input type="checkbox" aria-label="My label"/> |
|
<div role="checkbox" aria-label="My label"> |
|
e.setAttribute('aria-label', 'My label'); |
|
e.ariaLabel = 'My label'; |
|
Setting Code | Return value of .ariaLabel |
---|---|
<input type="checkbox" aria-labelledby="id-label"/><span id="id-label">My label</span> |
My label
|
<div role="checkbox" title="My label"> |
|
e.setAttribute('title', 'My label'); |
|
e.title = 'My label'; |
|
NOTE: Getting value of .ariaLabel
property is only associated with the aria-label
attribute, and is not a way to get the "computed" label for an widget element.