Skip to content

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Sep 22, 2025

We need tooltip delay functionality on icon buttons for mouse pointers. Slack reference (Internal access only)

We are adding a flexibility to delay the tooltip.

Changelog

New

I added a delay prop with an enum: instant (50ms) as default , medium (400ms), long (1200ms)

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

You can view the stories below:

For medium delay: https://primer-83c142dcae-13348165.drafts.github.io/storybook/?path=/story/components-tooltipv2-features--with-medium-delay

For long delay: https://primer-83c142dcae-13348165.drafts.github.io/storybook/?path=/story/components-tooltipv2-features--with-long-delay

You can also view this story to observe delay functionality for Icon Button: https://primer-83c142dcae-13348165.drafts.github.io/storybook/?path=/story/components-iconbutton-features--long-delayed-tooltip

Merge checklist

Copy link

changeset-bot bot commented Sep 22, 2025

🦋 Changeset detected

Latest commit: 52f36a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@primer/react Minor
@primer/styled-react Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 22, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!


export const DelayedTooltip = () => (
<Tooltip text="This is a tooltip with 600ms delay" delay={600}>
<IconButton icon={HeartIcon} aria-label="HeartIcon" />
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of adding another prop to the IconButton, I thought we can use external tooltip if we want to delay the tooltip, as it feels like it is not as common as changing directions where we have a dedicated prop on icon button -- but totally open to feedback 🙌🏻

* Delay in milliseconds before showing the tooltip
* @default 50
*/
delay?: number
Copy link
Member

Choose a reason for hiding this comment

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

I really think this is a risky thing to do.

Here's my preference (in order), we should get primer designers to weigh in

  1. If we can, have the delay baked into the component instead of instance
  2. If we do have to add a delay on an instance, it's one fixed number, not something you have to decide. (delayed: boolean instead of delay: number)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah totally fair. I am not comfortable to have this as a free text field either, just wanted to push something as we are not super clear about the direction 😄

@github-actions github-actions bot requested a deployment to storybook-preview-6889 September 24, 2025 09:13 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6889 September 24, 2025 09:21 Inactive
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds delay functionality to tooltips with three predefined options: instant (50ms, default), medium (400ms), and long (1200ms). This enhancement provides better control over tooltip timing, particularly useful for icon buttons where immediate tooltips might be distracting when users are simply moving their mouse across elements.

  • Added a new delay prop to the Tooltip component with enum values for different timing options
  • Implemented delay mapping logic that converts string values to milliseconds
  • Created Storybook examples demonstrating the new delay functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/TooltipV2/Tooltip.tsx Added delay prop, mapping object, and implementation of delay functionality
packages/react/src/TooltipV2/Tooltip.features.stories.tsx Added stories demonstrating medium and long delay options
packages/react/src/Button/IconButton.features.stories.tsx Added example showing long delay tooltip usage with IconButton
.changeset/famous-jobs-applaud.md Changeset documenting the new minor feature

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Looks great overall, left some minor nits

Approving in advance

* long 1200ms
*/
delay?: number
delay?: 'instant' | 'medium' | 'long'
Copy link
Member

Choose a reason for hiding this comment

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

nit: instant delay sounds strange? how about short delay, goes well with short | medium | long

Copy link

Choose a reason for hiding this comment

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

Is 50ms considered instant? in this case I'm pro 'short'. Otherwise, if it's exactly 0, then maybe 'none' would be most appropriate?

Copy link
Member Author

@broccolinisoup broccolinisoup Sep 26, 2025

Choose a reason for hiding this comment

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

This is a good point. Since we have 50ms as default, none or instant would be misleading. I'll update this to be short

</div>
)

export const OcticonPicker = {
Copy link
Member

Choose a reason for hiding this comment

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

I don't mind keeping this story in Tooltip.examples.stories, especially with a comment of which instance in dotcom does this represent

Copy link
Member Author

Choose a reason for hiding this comment

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

I was tempted to leave this but wasn't sure if that was very helpful. I'll tidy up and push it back 🚀

* @default 50
* @default instant 50ms
* medium 400ms
* long 1200ms
Copy link
Member

Choose a reason for hiding this comment

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

Can we leave a comment on how we picked these numbers?

They feel arbitrary in code so it would be nice to have the context (or a link to the context) so that, in the future when someone wants to change these, they have more information

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good idea! I'll add some context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants