Page MenuHomePhabricator

Tooltip: Add Tooltip component to Codex
Closed, ResolvedPublic

Description

Background

We need to implement the Tooltip component in Codex.
Considerations (from T280677):

  • Reconsider the trigger behavior to be more accessible (see T312899)
  • Provide more detailed guidelines on the position and size of the pop-up overlay on Desktop vs Mobile
  • Also take into account tooltips elsewhere: MultimediaViewer with jquery.tipsy implementation (see existibng implementations below)

Description

Tooltip component provides additional information when user hovers and/or clicks on it.

User stories

  • As a user, I need additional information about a user interface element in order to understand how to use it more effectively.

History

Known use cases

Captura de pantalla 2023-06-26 a las 18.12.41.png (290×964 px, 19 KB)
Tooltip within the Label in a Form Field (it will be implemented in T338282)
Captura de pantalla 2023-06-28 a las 11.36.36.png (994×1 px, 114 KB)
Wikifunctions tooltips. They are using the native ones, but they could be replaced with the Codex one once it's implemented. Keep in mind that native tooltips work differently in each browser.

Existing implementations

These artifacts are listed for context and to inform design and development. The figma spec, linked below, will be the source of truth for the new component.

image.png (356×878 px, 39 KB)
image.png (298×758 px, 31 KB)
Tooltips in OOUI, seen on Special:Preferences > Notifications (Desktop and mobile)
image.png (440×500 px, 41 KB)
MultimediaViewer with jquery.tipsy implementation
image.png (384×722 px, 62 KB)
Growth implementation in Vue (See related task T340199)

Wikimedia community:

External libraries:


Codex implementation

Component task owners

  • Designer: add the main designer's name
  • Developer: add the main developer's name

Open questions

  • Do we want to implement both the small dark tooltip and the big white one within the same Tooltip component? Or do we want to separate them into Tooltip and Popup?

Right now, we will be prioritizing the Tooltip (small, simple component) first.

Design spec

Component Figma exploration

Details for the design of the Tooltip can be found in T364638.

Documentation

Designer should describe how the component should be documented, including configurable and standalone demos.


Acceptance criteria

Minimum viable product

This task covers the minimum viable product (MVP) version of this component. MVP includes basic layout, default states, and most important functionality.

MVP scope

  • List all parts of the MVP scope for this component

Design

  • Design the Figma spec sheet and add a link to it in this task
  • Publish the component in the Figma library. This step will be done by a DST member.

Code

  • Implement the Vue component in Codex
  • Implement the CSS-only component in Codex (optional -- TBD as part of refinement)

Future work

  • If applicable, list future work that should be done for this component after the MVP is implemented as part of this task. You should open new, standalone tasks for all future work.

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
CCiufo-WMF triaged this task as Medium priority.Jul 25 2023, 2:49 PM

When we get around to this, I'm curious to know how much overlap there is with tasks like T274105. In https://www.mediawiki.org/wiki/Codex/Planned_Components we make a distinction between "Tooltips" and "Popups/Popovers", but based on the inventory in this task there may be overlap.

When we get around to this, I'm curious to know how much overlap there is with tasks like T274105. In https://www.mediawiki.org/wiki/Codex/Planned_Components we make a distinction between "Tooltips" and "Popups/Popovers", but based on the inventory in this task there may be overlap.

Included this as an open question in this task. We will need to discuss with the DST both options:

  1. Include both small dark and long white as tooltips and separate them into 2 different variants (as Material does)
  2. Include the small dark as tooltip and the white one as popup.

I lean towards including the white one as a separate component since I view the following visual differences between them:

TooltipPopup
Small dark element (usually one text line)Longer white element with long text.
Just a dark box with rounded corners.A box with an arrow pointing to the side from which this popup emerges.
Just textText, icons, images, and even buttons.
Not sure if the text could support different formats such as Bold, Italic or even links.The text within a popup could use different text formats and links could be included within the text.
NOTE: Currently, the white popups in our different projects are displayed when hover, so both Tooltip and Popup use the same interactive state to be displayed.

I would implement Tooltip for supplementary information and short text-only texts and Popup for longer texts potentially including other content (such as icon or image).

When we get around to this, I'm curious to know how much overlap there is with tasks like T274105. In https://www.mediawiki.org/wiki/Codex/Planned_Components we make a distinction between "Tooltips" and "Popups/Popovers", but based on the inventory in this task there may be overlap.

Included this as an open question in this task. We will need to discuss with the DST both options:

  1. Include both small dark and long white as tooltips and separate them into 2 different variants (as Material does)
  2. Include the small dark as tooltip and the white one as popup.

I lean towards including the white one as a separate component since I view the following visual differences between them:

TooltipPopup
Small dark element (usually one text line)Longer white element with long text.
Just a dark box with rounded corners.A box with an arrow pointing to the side from which this popup emerges.
Just textText, icons, images, and even buttons.
Not sure if the text could support different formats such as Bold, Italic or even links.The text within a popup could use different text formats and links could be included within the text.

I would suggest we remove visual style like backgrond colour as differentiator to which component it is.

NOTE: Currently, the white popups in our different projects are displayed when hover, so both Tooltip and Popup use the same interactive state to be displayed.

This is not strictly accurate. The tooltips which have white background that appear for example in Special:Preferences#mw-prefsection-echo appear on select, not on hover:

image.png (366×1 px, 51 KB)

I would implement Tooltip for supplementary information and short text-only texts and Popup for longer texts potentially including other content (such as icon or image).

Important to determine guidance for which to use in a form if this is the direction, and also consider to what extent this should tie appearance of popovers vs tooltips. There for example are cases where the explanation of how a field or component works includes a link, icon, and/or images:

Mentor dashboard module
image.png (822×1 px, 118 KB)
suggested edits task type
image.png (614×808 px, 95 KB)

I think it is important, when referencing existing examples to help define what a Tooltip and Popover should be, to consider if the existing examples should be this type of interaction to begin with, or if maybe these are potentially inappropriate uses of hiding content in a container like this. I know this notion complicates this task and decision a little more, but I think it's worth questioning so we build the correct versions of these components. Not saying they are all misuses, but I think there are some that might be questionable.

I think it is important, when referencing existing examples to help define what a Tooltip and Popover should be, to consider if the existing examples should be this type of interaction to begin with, or if maybe these are potentially inappropriate uses of hiding content in a container like this. I know this notion complicates this task and decision a little more, but I think it's worth questioning so we build the correct versions of these components. Not saying they are all misuses, but I think there are some that might be questionable.

Agree the guidelines of what is a tooltip makes sense to define. It seems like there are two competing definitions of tooltips here – the hover text-only one and the on-select one with ability to include more structured and interactive content like heading and paragraphs, links,image, icons, etc. My understanding of it being more the latter is based on the definition of how it is a "planned component" based on multiple use cases across Wikimedia products and per the Tooltip row in T277047: Design inventory of Wikiverse (Codex design system, OOUI, MediaWiki widgets) UI components referencing it as a core component and linking to the OOUI demo:

image.png (382×1 px, 72 KB)

It is slightly confusing, since the OOUI component itself is called PopupButtonWidget, but as there is no PopUp component captured, what I believe to be the case is that this task is about providing a tooltip/popup/helper needed for Codex to replace the many different places currently using the OOUI version.

Maybe @Volker_E who originated the inventory task or @CCiufo-WMF can weigh in about whether this should be separated into two tasks, and if in fact it is a separate "popup tips" component that is needed, distinct from tooltips.

After poking at this for bit, I think there is some confusing overlap between the Menu, Popover, and Dialog components. For this specific task I'd like to propose focusing on the most simple version of a tooltip with a draft definition of: "Tooltips are brief labels explaining UI elements, triggered by hover, focus, tap, or click.". These don't include any links, buttons, etc.

Here are example screenshots of a Tooltip from Material Design, Polaris, and Carbon.

Screenshot 2024-04-19 at 12.32.24 PM.png (392×342 px, 36 KB)
Screenshot 2024-04-19 at 12.32.47 PM.png (312×642 px, 25 KB)
Screenshot 2024-04-19 at 12.32.31 PM.png (196×462 px, 16 KB)

The secondary part of my proposal is that we create a separate task where we dig into popovers and make sure the definition and use case is clear. For example: Various other systems combine menu's and popovers...do we need to reconsider the buckets of everything that is an overlay of any sort? There is a world where that exploration could bring it back to the tooltip (Simple vs Rich tooltip) but separating these into distinct buckets should help us keep things moving.

Anyone oppose this idea? If not, @JFernandez-WMF we don't expect you to solve both of these. I'd lean towards you taking on the simple tooltip but I'll leave that up to you.

Our list of planned components has separate entries for a "Tooltip" and "Popup/Popover" component. As I mentioned in T340456#9482792, I worry this task conflates the two. The immediate need for a Tooltip component is to unblock T338282: Label: Add tooltip, which would be used by Wikidata's Query Builder and for Community Configuration 2.0. As I understand it, these are pretty simple use cases where all that's needed is providing brief supplementary information. Whether it appears only on hover or can also be activated through some other event is something I leave to the designers based on the need for touchscreen support / accessibility reasons.

In my opinion, we should keep the scope of this task small based on the needs we know of, while leaving the door open to either a) adding new functionality to this component which supports some of the more complex use cases or b) create a separate Popup/Popovers component.

After discussion with Chris and Julieta, we will keep the Tooltip component separate from the Popover component, which has its own task.

Julieta will continue forward with contributing the Tooltip component to Codex. Further definition and functionality is to be determined and will be updated in this task as that understanding becomes available.

After discussion with Chris and Julieta, we will keep the Tooltip component separate from the Popover component, which has its own task.

Julieta will continue forward with contributing the Tooltip component to Codex. Further definition and functionality is to be determined and will be updated in this task as that understanding becomes available.

Thank you @DTorsani-WMF. To avoid confusion, I've removed some of the use cases in this Tooltip task since they were Popups/Popovers instead and they were duplicated in T363375: [EPIC] Popover: Add Popover component to Codex.

Regarding Label's info icon, in case we want to separate into Tooltip and Popover components, I think this Label's case would be covered with a Popover instead. So I would also remove these Label use cases from this task and I would redefine T338282: Label: Add tooltip to indicate that it will use a Popover instead.

Okay thanks @bmartinezcalvo! We are still working through the exact definitions of Tooltip, so I will update these once we have a bit more clarity on that.

Change #1027265 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[design/codex@main] [WIP] Tooltip component (directive)

https://gerrit.wikimedia.org/r/1027265

I'd like to keep this component on the DST roadmap. @DTorsani-WMF I'm co-assigning you to T364638. Let's use that one on our sprint boards.

Change #1027265 merged by jenkins-bot:

[design/codex@main] Tooltip: Introduce WIP component (directive)

https://gerrit.wikimedia.org/r/1027265

Change #1049640 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from 1.7.0 to 1.8.0

https://gerrit.wikimedia.org/r/1049640

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/f74be9bc8e/w

Change #1049640 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from 1.7.0 to 1.8.0

https://gerrit.wikimedia.org/r/1049640

CCiufo-WMF changed the task status from Open to In Progress.Jul 4 2024, 5:19 PM

I think we are ready to resolve this task -- @JFernandez-WMF would you like the honors?

Yes! It was great working on this, thanks DST — very excited! ♡