Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

title

Advisory text shown as a mouse-hover tooltip and used as an accessible name or description. Good for abbr and iframe; never the only place for important text.

Overview

The title attribute holds advisory text about an element. Desktop browsers show it as a tooltip after the mouse rests on the element. Assistive technology uses it too: as the element's name when nothing else names it, otherwise as its description. This is the title attribute, not the <title> element in <head>.

Applies to: every element (it is a global attribute). On <link>, <style>, <abbr> and <dfn> it has extra meaning (see Values).

Values

ValueMeaning
Any textAdvisory text for this element. Line feeds (&#10;) start new lines in the tooltip.
"" (empty)No advisory text, and stops an ancestor's title from applying here.
AbsentInherits the nearest ancestor's title for the tooltip.

Special meanings:

  • <abbr title> and <dfn title>: the expansion or the term being defined, and nothing else.
  • <link rel="stylesheet" title> and <style title>: names a stylesheet set; rel="alternate stylesheet" makes it switchable.
  • <iframe title>: the frame's accessible name, announced before the user enters it.

Examples

Abbreviations

The tooltip is mouse-only, so also write the expansion out in the text the first time an abbreviation appears.

Naming an iframe

Alternatives

For anything the user needs, use visible text or a proper name and description.

NeedUse
Name for an icon-only buttonaria-label, or visible text with .visually-hidden
Tooltip that works with keyboard<tool-tip>, or a popover="hint" tooltip
Field help<output class="hint"> inside <form-field>
Optional detail<details>
Image descriptionalt

In Vanilla Breeze

  • abbr[title] gets a dotted underline and a help cursor; the underline turns the interactive colour on hover. An <abbr> without title stays plain (src/native-elements/inline-semantics/styles.css).
  • Print expands abbreviations. VB's print stylesheet appends the expansion after each abbr[title], for example "WHO (World Health Organization)" (src/utils/print.css).
  • Icon-only buttons. A button whose only child is an <icon-wc> and that has aria-label, aria-labelledby or title gets square padding (src/native-elements/button/styles.css).
  • <tool-tip> upgrades title. When it has no <template data-tooltip> or content, it uses the trigger's title as its text. It removes the title while upgraded to prevent a double tooltip, copies it to aria-label if it was the trigger's only name, and puts it back when removed (src/web-components/tool-tip/logic.js).
  • Shortcut labels. data-hotkey action bindings name themselves from the element's text, then placeholder, then title, unless you set data-hotkey-label (src/utils/hotkey-action-init.js).

Accessibility

  • Name or description. In the accessible-name calculation title is the last resort: if nothing else names the element (content, aria-label, a <label>), title becomes its name. Otherwise it becomes its description and is read after the name.
  • The real problem is who can see it. The tooltip needs a mouse. Keyboard and touch users never see it, so text that only lives in title is missing for them.
  • Never the only label for a form field. A field named only by title has a name for screen readers but no visible label (WCAG 3.3.2 Labels or Instructions).
  • Do not repeat visible text. A title equal to the element's text adds nothing and may be read twice.
  • Every iframe needs a name. title is the usual way (WCAG 4.1.2).

Gotchas

  • Inheritance surprises. A title on a container shows on every descendant. Use title="" on a child to stop it.
  • Timing and style are fixed. You cannot change the delay, position or appearance of the browser tooltip.
  • Plain text only. No markup; line feeds work.

Related

Which to choose

  • title — abbreviation expansions, iframe names, and optional hover hints that repeat information available elsewhere.
  • <tool-tip> — a tooltip that keyboard users also get.
  • aria-label / visible text — the name of a control.
↑