nico3333fr / jquery-accessible-dialog-tooltip-aria Goto Github PK
View Code? Open in Web Editor NEWjQuery simple and accessible dialog tooltip window, using ARIA
License: MIT License
jQuery simple and accessible dialog tooltip window, using ARIA
License: MIT License
Many thanks for this solution! It works perfectly for us (cannot share the URL yet, as we are still working on the site).
We are using not a real button but an SVG image for the tooltip. Thus I had to look around for how to keep accessibility. I ended up with this code:
<img src="/img/info.svg"
class="js-tooltip" data-tooltip-prefix-class="simple-tooltip" data-tooltip-content-id="info_waterHeater" data-tooltip-close-text="X"
role="button"
tabindex="0"
onkeydown="if(event.keyCode==13||event.keyCode==32){event.preventDefault();$(this).click();}">
This clearly is nothing specific to your code, but maybe others would like to use an image as button as well. The last three lines are needed to keep accessibility:
role="button"
signals its clickability (including different cursor on hover)
tabindex="0"
lets you tab to the clickable icon
onkeydown=...
ensures that a click is triggered on pressing either the ENTER or SPACE key.
I found the needed info mostly on this page https://www.deque.com/blog/accessible-aria-buttons/
Chrome is executing
if ( !$target.is('.js-dialogtooltip') && !$target.is('.js-tooltip') && !$target.parents(".js-dialogtooltip").is(".js-dialogtooltip")) { $('.js-dialogtooltip').remove(); }
After having opened a tooltip (yes, it is stupid, IE/Firefox are not doing it). Only way to solve, add a timeout on opening.
See the « publishing npm package » documentation.
Bonjour Nicolas,
Est-ce que ton plugin pourrait marcher avec un tooltip qui s'afficherait au survol plutôt qu'au clic ? et est-ce que ça serait toujours accessible ?
Merci !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.