Opened 4 months ago
Closed 4 weeks ago
#65633 closed enhancement (fixed)
Toggle tips should also display tooltips
| Reported by: | joedolson | Owned by: | joedolson |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | General | Version: | 7.1 |
| Severity: | normal | Keywords: | has-patch has-unit-tests commit |
| Cc: | Focuses: | ui, accessibility, javascript |
Description
With no visible text label, a toggle tip needs to also display a tooltip to expose its accessible name.
This was deemed a nice to have in #51006, but not critical for initial implementation, as it adds significant complexity.
Attachments (7)
Change History (26)
This ticket was mentioned in PR #12532 on WordPress/wordpress-develop by @iamchitti.
4 months ago
#3
- Keywords has-patch has-unit-tests added
## Trac ticket
https://core.trac.wordpress.org/ticket/65633
## Summary
With no visible text label, a toggle tip's toggle button (from wp_get_toggletip()) exposes its accessible name only through aria-label. That name reaches assistive technologies but is invisible to sighted mouse and keyboard users, who get no on-hover or on-focus indication of what the button does.
A tooltip already shows a hover/focus popover surfacing its accessible name. This PR brings the same affordance to toggle tips, which was deferred as a "nice to have" in #51006.
## Changes
wp-includes/general-template.php— the toggle tip markup now also outputs a hint popover carrying the button's label:`html <span popover="hint" id="{id}-hint" class="wp-tooltipbubble wp-tooltiphint" aria-hidden="true">
<span class="wp-tooltiptext">{label}</span>
</span>
It is aria-hidden on purpose — the button already announces its name via
aria-label, so the hint stays purely visual and avoids a duplicate announcement.
js/_enqueues/wp/wp-tooltip.js— shows the hint on mouseenter/focus and hides it on mouseleave/blur, mirroring the tooltip behaviour. The hint is suppressed while the toggle tip dialog is open, so the two never overlap.wp-admin/css/wp-tooltip.css—.wp-tooltip__hintreuses the tooltip bubble styling.tests/phpunit/tests/general/wpGetTooltip.php— added coverage for the hint markup, label duplication, and escaping.
Behaviour is unchanged for the tooltip type and for assistive technologies.
## Testing instructions
- Run npm run dev so the JS/CSS rebuild.
- Open wp-login.php and locate the ? help icon next to the "Remember Me" checkbox.
- Hover or Tab to the icon → a small "Help" tooltip appears after ~300ms; it hides on mouse-leave/blur.
- Click the icon → the help dialog opens and the hint disappears (no overlap). Hovering the icon while the dialog is open does not re-show the hint.
- Inspect the toggle button: it still has aria-label="Help", and the hint is aria-hidden="true" (a screen reader announces the name once, not twice).
- Run the tests: npm run test:php -- --filter Tests_General_wpGetTooltip.
## Screenshots
Related
- Follow-up to https://core.trac.wordpress.org/ticket/51006
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
3 months ago
#6
@
7 weeks ago
# TEST #260917110403
› OS: MacOS 26.6.2
› APP: Arc 1.164.0 / Playground / DevTools device simulator
› Device : Desktop / iPad 13 / iPhone 16
› WP : 7.1-alpha-20260715.063422
› PHP : 7.4
Seems OK for me 👍️
Sebastien-Gastard commented on PR #12532:
7 weeks ago
#7
@audrasjb commented on PR #12532:
7 weeks ago
#8
There was a conflict between this PR and current trunk, I resolved it by accepting both changes.
Testing welcome!
bdi-digital commented on PR #12532:
7 weeks ago
#9
Tooltip on toggle tip button is correctly displayed on the following configurations :
- Mac OS / Voice Over 26.5.2 / Google Chrome 152
- Android 17 / Talkback 17 / Google Chrome 153 (The visible label is displayed after tapping on close button on the tooltip)
Note :
On iOS / Voice Over 26.6.1 / Safari (The visible label is only displayed when Voice Over is activated). Otherwise it's not displayed.
@audrasjb commented on PR #12532:
7 weeks ago
#10
Note: we have some type issues in various variables. The issues weren't here before but I think these tests didn't exist at the time the PR was proposed :)
Worth fixing these issue though
@nicoblandel commented on PR #12532:
7 weeks ago
#11
I tested keyboard navigation and it works correctly!
https://github.com/user-attachments/assets/23f1c75d-c759-442a-8a8f-fd4e69ac4d93
@battelfred commented on PR #12532:
7 weeks ago
#12
@iamchitti commented on PR #12532:
7 weeks ago
#13
Note: we have some type issues in various variables. The issues weren't here before but I think these tests didn't exist at the time the PR was proposed :)
Worth fixing these issue though
I'm taking a look at the failing actions.
@iamchitti commented on PR #12532:
7 weeks ago
#14
JS type test is fixed. The remaining failing tests are also failing on trunk.
@iamchitti commented on PR #12532:
7 weeks ago
#15
Would suggest re-testing, as the toggletip markup was briefly broken by a bad trunk merge.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
5 weeks ago
@joedolson commented on PR #12532:
4 weeks ago
#18
@bdi-digital I'm unable to locate a WordPress profile for you, so I'm not able to give you props during commit - if you have a WordPress profile, please link it to your Github profile using the guidance provided above! If you don't, I suggest creating one, so you can be properly credited for your contribution! Thank you!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
A toggle tip (as returned by
wp_get_toggletip()) renders an icon-only toggle button with no visible text label. Its accessible name comes solely fromaria-label, so it is exposed to assistive technologies but not to sighted mouse or keyboard users, who get no on-hover or on-focus indication of what the button does.By contrast, a
tooltipalready shows a hover/focus popover that surfaces its accessible name. This ticket brings the same affordance to toggle tips, which was deemed a "nice to have" and deferred in #51006.Proposed fix
Give the toggle button its own hover/focus hint that visually exposes the same accessible name, reusing the existing tooltip presentation. The hint is
aria-hidden, since the button already announces its name viaaria-label, so it stays purely visual and avoids a duplicate announcement. It is suppressed while the toggle tip dialog itself is open, so the two never overlap.Behaviour is unchanged for the
tooltiptype and for assistive technologies.I'll open a PR shortly.