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

feat(slider): add tooltips for single and two handle sliders #15129

Merged
merged 27 commits into from
Dec 4, 2023

Conversation

m4olivei
Copy link
Contributor

@m4olivei m4olivei commented Nov 8, 2023

Closes #14549

Adds tooltips to the Slider componet handles. Currently present by default for both single handle and double handle. Subject to design approval.

Changelog

New

  • Single and two handle Slider's now have a tooltip that displays on focus / hover that will show the current slider value

Testing / Reviewing

  • Open the Default Slider story. Should work the same with no regressions. We expect no tooltips when there are text inputs.
  • Open the Slider > Two Handle Slider story. Should work the same with no regressions. We expect no tooltips when there are text inputs.
  • Pay particular attention to regressions in thumb / handle positioning. Was necessary to adjust CSS transforms to accomodate when there are tooltips present.
  • Open the Slider > Slider with Hidden Inputs story. Here we expect tooltips to show on hover / focus.
  • Tooltips should lock open while dragging handles.
  • Tooltips should be positioned per design guidance
  • Pay particular attention to the Tooltips, should behave just like the Tooltip component in isolation in terms of hover / delay / focus behaviours and spacing.
  • Regression testing for Tooltip stories, eg. IconButton > Default, Tooltip > Default and friends.

@m4olivei m4olivei requested a review from a team as a code owner November 8, 2023 20:11
Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 65a5dc7
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/655e7220d5c277000865eb5f
😎 Deploy Preview https://deploy-preview-15129--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 573a500
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/654ce64c26dd5000084b7958
😎 Deploy Preview https://deploy-preview-15129--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@m4olivei
Copy link
Contributor Author

m4olivei commented Nov 8, 2023

Ahh, there are some legit test failures on account of markup and styles here that needed to shuffle around on account of the Tooltips.

I'll take a look at those in the morning.

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code side of things looks pretty solid. The interaction when dragging is a bit odd though. The tooltip seems to disappear randomly. Also when you drag and get near the other handle, the other handle's tooltip appears on hover, which probably shouldn't happen.

two.handle.slider.dragging.interaction.mov

Would it make sense to "lock" the tooltip open (or closed) when dragging? @laurenmrice do you have any thoughts?

@tay1orjones
Copy link
Member

@m4olivei If you haven't already, could you take a look at how this impacts the way in which the component is read via screenreaders? I wonder if it might make sense to hide the tooltips from assistive tech?

@tay1orjones
Copy link
Member

I also see there's some recent comments on the original issue questioning the approach #14549 (comment)

@tay1orjones tay1orjones removed the request for review from andreancardona November 9, 2023 17:12
@laurenmrice
Copy link
Member

See update in connected issue #14549 (comment)

@laurenmrice
Copy link
Member

Following on to Kevins comment above^

It may be the fact there are 2 different kinds of active states happening and one of them is a bug?

  1. One is blue and the tooltip appears.
  2. One is black and the tooltip disappears. (I think this is the bug)

Nov-21-2023 10-04-12

@m4olivei
Copy link
Contributor Author

Nice catches!

Upon checking the base skeleton state on Chrome and Safari, the handle icon gets squashed and stretched.

This is a regression, I hadn't even checked the skeletons. Oops 😊 .

The tooltip only appears on hover, but I believe it should appear upon being active and interacted with. If a user misses the target, they won't have a tooltip unless directly hovered.

This is a bug. I'm not accounting for and locking the tooltip open, when the drag start begins with a track click, and not a direct click on the handle.

Will work on these probably tomorrow, but maybe today if I can burn through some other tasks.

@m4olivei
Copy link
Contributor Author

@KevinCamelo @laurenmrice

  • Skeleton slider issues are fixed, including a regression that snuck in on the last PR where handles were lost.
  • The track click and drag issue is now fixed as well
  • I also found and addressed RTL issues for the Skeletons and for the tooltip use cases

Should be ready for another look.

@KevinCamelo
Copy link

@m4olivei LGTM! 💯 Great work. Love that we were able to sneak in the tooltips. I'm going to let Carbon have final say on if this is good to go but I think it is. CC: @laurenmrice 😄

@laurenmrice
Copy link
Member

Looks good to me! Thanks @m4olivei !

Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🥳

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 🎉

@github-actions github-actions bot added this pull request to the merge queue Nov 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 30, 2023
@m4olivei
Copy link
Contributor Author

m4olivei commented Dec 4, 2023

Yay, approved! @tay1orjones noticed that we got booted from the merge queue. I'm unclear on why, do you have any insight?

@tay1orjones tay1orjones merged commit 8263d2c into carbon-design-system:main Dec 4, 2023
23 checks passed
@tay1orjones
Copy link
Member

@m4olivei sorry, not sure. Sometimes the merge queue checks time out without reason. We're still figuring out the best settings for the merge queue. We got this in though just now 👍

@m4olivei m4olivei deleted the feat/slider-tooltips branch December 4, 2023 20:42
@m4olivei
Copy link
Contributor Author

m4olivei commented Dec 4, 2023

Thanks @tay1orjones !

danoro96 pushed a commit to danoro96/carbon that referenced this pull request Jan 18, 2024
…design-system#15129)

* fix(slider): refine what is focusable to be more broadly inclusive

* feat(slider): add tooltips to slider

* fix(slider): adjust for nice default tooltips on single handle

* fix(slider): correct single handle RTL bug

* fix(slider): put back the focus handler for the lower thumb

* fix(slider): rtl positioning bug

* chore: udpate tests

* test(slider): adjust unit tests for slider w/ tooltips

* fix(slider): remove space when text input is hidden

* fix(slider): restore blue focus filled track

* feat(slider): adjustments to tooltip positioning

* feat(slider): use a ThumbWrapper component to conditionaly do tooltips

* feat(slider): add stories for hidden inputs

* fix(tooltip): hold the tooltip open if the user is mid-drag interaction

* refactor(slider): move slider handle componets into own file

* fix(slider): make skeletons good again

* fix(slider): manage focus when activating using the track

* chore(slider): remove redundant preventDefault

* fix(slider): more robust activeHandle detection

* test(slider): fix slider tests

* fix(slider): fix positioning of thumbs for rtl

* fix(slider): correct tooltips rtl

---------

Co-authored-by: Andrea N. Cardona <cardona.n.andrea@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Range Slider - Handle Tooltip Hovers
6 participants