Joomla! Programmers Documentation

Manual Index

Tooltip

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Overview

Tooltips are useful elements. They allow presenting information with an icon or a short text and adding additional informationn when the users hovers the icon or text. If several tooltips are on a page, every toolpip must have an own ID. Other wise a screenreader cannot identify which tooltip gives Information to which element.

Code Snippet

<span class=".." aria-describedby="tip-unpublish<?php echo $i; ?>">
    <?php echo $item->count_published; ?>
</span>
<div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
   <?php echo Text::_('COM_MENUS_COUNT_UNPUBLISHED_ITEMS'); ?>
</div>
<a href="/.." aria-describedby="editarticle-<?php echo $id; ?>">
    <span class="icon-edit" aria-hidden="true"></span>Edit
    <div role="tooltip" id="editarticle-<?php echo $id; ?>">Published Article</div>
</a>       

Common Mistakes

  • Missing ID.
  • ID not uniquee.

Example in Joomla

A tooltip on a element in a table: administrator/components/com_menus/tmpl/menu/default.php

A tooltip in the frontend which is visible for editable content (if you have permission for editing) components/com_content/tmpl/article/form.php

Who is affected?

People using screen readers need ....

People with cognitive disabilities need ... etc.

Who is impacted most by the accessibility of this element?

Testing for accessibility

How does someone test that this is accessible with a screenreader?

  1. Use the screen reader to navigate to ...
  2. Make sure ...
  3. Make sure ...
  4. If ... then it passes. ✅
  5. If ... then it fails. ❌

How does someone test that this is accessible with web inspector?

  1. Right Click > Inspect ... on the page.
  2. Make sure ...
  3. Make sure ...
  4. If ... then it passes. ✅
  5. If ... then it fails. ❌
  6. If ... then it passes. ✅
  7. If ... then it fails. ❌

Relevant WCAG Success Criteria

Relevant ATAG Guidelines (optional)