Skip to content

Accessible tooltips

Tooltips in four positions that open on hover, tap and keyboard focus, and close with Escape, as WCAG requires.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

On a tradesperson’s quote, puzzling terms (ten-year warranty, 10 % VAT, tax included, deposit) are explained in a tooltip placed above, right, below or left, chosen with a simple ibl-tip--top, --right, --bottom or --left class. Display relies on CSS alone (:hover and :focus-within): without JavaScript, hover and keyboard already work. About thirty lines of dependency-free script add what CSS cannot do: the Escape key closes the tooltip without moving focus or the mouse, and a tap opens it even where the button does not take focus. WCAG 1.4.13 is met: the mouse can move onto the tooltip text without it disappearing, it stays visible until you leave it, and it can be dismissed on demand. Each trigger is a real button linked to its tooltip with aria-describedby and role="tooltip": screen readers read the explanation along with the term. On phones, side tooltips open below or above so they never leave the screen from 360 px. Fade and slight slide on transform and opacity, removed with prefers-reduced-motion; 44 px targets, rem sizes, AA contrast in light and dark, colours set through CSS variables prefixed ibl.

Code

Loading the code…

The code of this component in

Archive contents

info-bulle-accessible-html-tailwind.zip3 files · 6 Ko

  • index.html12 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • A slim bar at the top of the page with a message, a link and a close button; once closed, it stays hidden for the period you choose.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A sticky sidebar table of contents for blog posts: it highlights the section being read, shows the reading time left and folds into a list under the title on mobile.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A column of dots on the side of the page that follows the section being read and lets visitors jump to it, with a label on hover and focus.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An order step indicator: finished steps clickable to go back, the current step announced, upcoming steps locked.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component