Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tooltip appearance/disappearance timing #11091

Open
2 of 5 tasks
nCastle1 opened this issue Dec 17, 2024 · 7 comments
Open
2 of 5 tasks

Improve tooltip appearance/disappearance timing #11091

nCastle1 opened this issue Dec 17, 2024 · 7 comments
Assignees
Labels
2 - in development Issues that are actively being worked on. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.

Comments

@nCastle1
Copy link

Check existing issues

Description

Currently, Calcite tooltip is quite slow to disappear (and sometimes will just not disappear), but is very quick to appear on hover. This is the opposite of typical browser behavior, where tooltips are slow to appear, but disappear instantly. It is also different from the tooltip behavior of other libraries (e.g. bootstrap) that use floating-ui/poppers-js.

Demo showing delays with Calcite tooltip, and failure to dismiss in some cases:

Screen.Recording.2024-12-17.at.2.17.52.PM.mov

Another issue is that there seems to be a delay between when the mouse event happens and when the tooltip is shown or hidden; but by the time the tooltip appears it is no longer needed. This can look bad when multiple elements with tooltips are shown side-by-side, e.g. in an action bar:

Screen.Recording.2024-12-17.at.2.20.49.PM.mov

Demo of another implementation:

Screen.Recording.2024-12-17.at.2.19.18.PM.mov

Browser built-in tooltip behavior:

Screen.Recording.2024-12-17.at.2.24.11.PM.mov

(tooltip is slow to appear at first, but disappears instantly. If a tooltip has been shown very recently, subsequent tooltips are faster to appear)

Acceptance Criteria

  • Tooltips do not start to appear after the mouse has already left the reference element
  • Tooltips disappear immediately after the mouse has left the reference element
  • Tooltips do not appear when the mouse is not on the reference element

Relevant Info

Behavior appears to be the same for 2.x and 3.x tooltips, so I don't believe the issues are caused by recent Stencil migration work.

Which Component

calcite-tooltip

Example Use Case

I would like to use calcite tooltips for elements in a calcite-action-pad, but performance/behavior was unacceptable, so I had to remove them and rely on built-in browser tooltips.

Priority impact

impact - p2 - want for an upcoming milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

@nCastle1 nCastle1 added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Dec 17, 2024
@github-actions github-actions bot added ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone labels Dec 17, 2024
@geospatialem geospatialem added p - medium Issue is non core or affecting less that 60% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment. and removed needs triage Planning workflow - pending design/dev review. labels Dec 18, 2024
@geospatialem
Copy link
Member

@nCastle1 Can you help our investigation on the above with a repro case of the current behavior?

@DitwanP
Copy link
Contributor

DitwanP commented Dec 18, 2024

To repro the case of tooltip not disappearing you have to quickly hover and remove the mouse from the tooltip and then do not move the mouse. ⚡️🛑

Screen.Recording.2024-12-18.at.11.17.26.AM.mov

@macandcheese
Copy link
Contributor

This would be a welcome improvement - I think the proposed changes would solve a lot of the UX problems - here's an example of how it's affecting the Component Sample. It's pretty frustrating to use and appears buggy with how quickly the tooltips are invoked and then disappear.

Screen.Recording.2025-01-29.at.4.03.42.PM.mov
Screen.Recording.2025-01-29.at.4.07.13.PM.mov

I also notice there's a few pixel gap between the invoking element and the rendered Tooltip - where it will dismiss if you try and move your cursor to the tooltip. But hovering over the tooltip persists it - creating a small unintentional window of dismissal - so maybe this gap should be achieved with padding instead of margin or offset placement if that isn't intended?

@driskull
Copy link
Member

Tooltips do not start to appear after the mouse has already left the reference element

We should fix this one.

Tooltips disappear immediately after the mouse has left the reference element

We cannot fix this one because we need to give the user time to hover over the tooltip.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role#required_javascript_features

Tooltips do not appear when the mouse is not on the reference element

I think this is probably the same as the first one

@driskull
Copy link
Member

This is the opposite of typical browser behavior, where tooltips are slow to appear, but disappear instantly.
It is also different from the tooltip behavior of other libraries (e.g. bootstrap) that use floating-ui/poppers-js.

I don't think those libraries are following this aria guideline: The tooltip stays open when hovered. Our tooltips are a bit more wordy where users may need to copy text from them or keep them open to read.

@mpayson
Copy link

mpayson commented Feb 18, 2025

Tooltips do not start to appear after the mouse has already left the reference element

We should fix this one.

Some additional information from my testing for #11573, I think this was working as expected in version 2.10

@driskull
Copy link
Member

I think we can proceed with fixing these:

  • Tooltips do not start to appear after the mouse has already left the reference element
  • Tooltips do not appear when the mouse is not on the reference element

This should also fix the issue when moving outside of an iframe because it will close the tooltip after a timeout instead of just with the mouse moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - in development Issues that are actively being worked on. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.
Projects
None yet
Development

No branches or pull requests

6 participants