Skip to content

fix(Tooltip): make tooltips with empty text inert - #8740

Draft
tay1orjones wants to merge 2 commits into
mainfrom
tay1orjones-tooltip-disabled-prop
Draft

tay1orjones wants to merge 2 commits into
mainfrom
tay1orjones-tooltip-disabled-prop

Conversation

@tay1orjones

Copy link
Copy Markdown
Contributor

Closes #8571

Keeping a Tooltip mounted while toggling its text avoids replacing the trigger and dropping focus. Empty text without a keybinding hint now makes Tooltip inert and removes its ARIA association.

Changelog

New

Changed

  • An empty text no longer opens a Tooltip or labels/describes its trigger when no keybindingHint is provided.

Removed

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

Automated coverage exercises focus retention, tooltip open/close behavior, and ARIA attributes; type-check and targeted lint pass. In the ConditionalText story, toggle the tooltip and confirm focus stays on the button and its accessible description disappears while the text is empty.

A tooltip with empty `text` (and no `keybindingHint`) no longer opens and
no longer labels or describes its trigger. That means you can turn a tooltip
off with `text={allowed ? '' : 'Not allowed'}` instead of conditionally
wrapping the trigger, which remounts it and drops focus.

Fixes #8571

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a187843

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

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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 the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions
github-actions Bot temporarily deployed to storybook-preview-8740 November 12, 2026 15:01 Inactive
@github-actions github-actions Bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 12, 2026
The empty-text effect cancelled the pending hover timer. If the text came back while the pointer was already over the trigger, no new mouseover fired, so the tooltip never opened.

The effect now only hides an open popover. The hover timer reads the latest props when it fires: it opens if content has returned and does nothing if the text is still empty.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@primer-integration

primer-integration Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Running  Changes   Running
Passed  CI   Passed
Waiting  VRT   Waiting
Waiting  Projects   Waiting

This branch was successfully deployed

2 active deployments
storybook-preview-8740 — a187843e Deployed Nov 13, 2026 by github-actions[bot]
github-pages — a187843e Deployed Nov 13, 2026 by tay1orjones via deploy-preview #34295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: failing Changes in this PR cause breaking changes in gh/gh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conditional tooltips make the trigger lose focus

1 participant