[wp-trac] [WordPress Trac] #51006: Add a mechanism for accessible tooltips in core
WordPress Trac
noreply at wordpress.org
Fri Feb 14 15:34:06 UTC 2025
#51006: Add a mechanism for accessible tooltips in core
-------------------------------------+-------------------------------------
Reporter: joedolson | Owner: joedolson
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.8
Component: General | Version:
Severity: normal | Resolution:
Keywords: tooltips has-patch | Focuses: ui, accessibility,
needs-testing needs-unit-tests | javascript
-------------------------------------+-------------------------------------
Comment (by swissspidy):
A bit late to the party, but just saw the notification about this.
Given that Gutenberg already maintains a tooltip component that could be
easily used elsewhere in WordPress admin, it seems silly to me to maintain
a completely separate implementation with a very different design and
functionality. I think this is a real missed opportunity. I see that was
mentioned before but never followed up on.
If a second implementation is required in the short term for whatever
reason, then this should be implemented in a way that the implementation
could be easily swapped out later without backward compatibility concerns,
for example by making this function private and not make it available to
plugins.
In such a case, I would also suggest looking at more modern web APIs that
make tooltips implementations a breeze, such as Popover API and CSS anchor
positioning. That means you can build accessible tooltips with basically
zero JavaScript.
Besides, I would strongly advocate for a different function name.
`add_tooltip` is too close to `add_option` or `add_post_meta`. Why not
`wp_print_tooltip` or something?
But again, why not explore using the existing Gutenberg component first
:-)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51006#comment:53>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list