Aria-practices: Tooltip dismiss key should not be escape

Created on 25 Aug 2020  路  2Comments  路  Source: w3c/aria-practices

This is generally related to #128, but I wanted to open a new issue specifically about changing the guidance about which key should dismiss a tooltip.

I've written and talked about this in more detail the past, but the general gist is that escape is not a good key for controlling content that appears on hover/focus. Tooltips can co-exist with other widgets where escape is already expected to do something else (e.g. close a modal, combobox, or other dropdown). Some examples where a tooltip handling escape would cause conflicts:

  • A tooltip within a modal
  • A tooltip on a combobox, menu item w/ submenu, etc.
  • A tooltip within a non-modal dialog or other popup

Even if one were to code escape in such a way that it first closes the tooltip and then performs its usual action on the second press, that causes additional problems:

  • Tooltips are not exposed as such to screen readers, and so the escape behavior would be unexpected and unpredictable
  • It's confusing to sighted users to have escape do different things on subsequent presses
  • No-one is going to want to risk pressing escape within a modal to dismiss a tooltip

I actually ran a usability study that included tooltips within modals and on elements that had dropdowns, and found that real users were not generally willing to press escape within a modal, even though I had coded it so that it would first close only the tooltip.

After brainstorming with coworkers, my suggestion for an alternative is the control key, since when pressed alone it doesn't have any conflicts with existing AT or application shortcuts that we could think of. Almost anything apart from escape would be welcome, though :)

Most helpful comment

I would almost rather the problems of the Escape key would force people to reconsider placing tooltips in those areas in the first place.
I worked at a place which used nested modals, because the love of modals was unbelievable, and it ran into exactly the same problem with dismissal, but additionally had trouble with focus management. A modal opens with a form inside. A form control opens another modal with another form. Inside that form, an alertdialog warning about impending deletion.

Maybe dancing backwards in high heels should be discouraged, with a Note on the SC?

All 2 comments

I would almost rather the problems of the Escape key would force people to reconsider placing tooltips in those areas in the first place.
I worked at a place which used nested modals, because the love of modals was unbelievable, and it ran into exactly the same problem with dismissal, but additionally had trouble with focus management. A modal opens with a form inside. A form control opens another modal with another form. Inside that form, an alertdialog warning about impending deletion.

Maybe dancing backwards in high heels should be discouraged, with a Note on the SC?

@StommePoes I am 100% in favor of a note in the pattern language that says tooltips should not be used 馃榿.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zcorpan picture zcorpan  路  5Comments

jongund picture jongund  路  8Comments

ZoeBijl picture ZoeBijl  路  5Comments

JAWS-test picture JAWS-test  路  4Comments

mcking65 picture mcking65  路  8Comments