javascript - Tooltip, accessibility -
building nice accessible web page hard. currently, im trying make tooltip web accessible , need help. guys have piece of advice it? aria attributes should use. or other important thing want add!
moreover, how prevent screen reader reading tooltip, if hasnt been shown? approach here make using javascript, adding , deleting aria-hidden
attribute, want avoid js as possible.
you'll have show tooltip on focusable element (if element not focusable, should set tabindex
attribute)
<input type="text" id="mytextbox" aria-describedby="mytooltip" /> <span id="mytooltip" role="tooltip" class="tooltip" aria-hidden="true">tooltip textbox</span>
the aria-describedby
set relationship between focusable element , tooltip. tooltip
role support not important, should use it's designed subject.
once done, have set initial state in css:
.tooltip[aria-hidden='true'] {display: none} .tooltip[aria-hidden='false'] {display: block}
and define aria-hidden
attribute true on focus
or mouseover
events using favorite javascript code, , false on blur
, mouseout
events.
Comments
Post a Comment