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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -