Skip to content

feat(theme-classic): replace native color mode tooltip with fast CSS …#11891

Closed
Injora wants to merge 1 commit intofacebook:mainfrom
Injora:feat/color-mode-fast-tooltip
Closed

feat(theme-classic): replace native color mode tooltip with fast CSS …#11891
Injora wants to merge 1 commit intofacebook:mainfrom
Injora:feat/color-mode-fast-tooltip

Conversation

@Injora
Copy link
Copy Markdown

@Injora Injora commented Apr 3, 2026

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

This PR improves the perceived performance and user experience of the ColorModeToggle by replacing the browser's slow, native title attribute with a fast, custom CSS-driven tooltip.

Previously, when hovering over the dark/light mode toggle, users had to wait for the standard browser and OS delay (often >1s) for the tooltip to appear. By moving this into a ::after pseudo-element and passing the label via a data-tooltip attribute, the tooltip now smoothly and rapidly fades in below the button, drastically enhancing the premium interactive feel of Docusaurus navbars.

Test Plan

  • Hovered over the ColorMode Toggle in both Light and Dark mode to verify the custom tooltip bubble correctly adapts (using --ifm-color-emphasis-900/100) and displays the appropriate translated mode label.
  • Clicked the toggle to cycle through themes and ensured the pseudo-element's attr(data-tooltip) updates instantaneously alongside the icon changes.
  • Tested using keyboard navigation (:focus-visible) to verify tooltip accessibility is preserved.
Screen.Recording.2026-04-03.at.12.04.05.mov

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

N/A — Self-identified visual UX enhancement.

@Injora Injora requested review from Josh-Cena and slorber as code owners April 3, 2026 06:45
@meta-cla meta-cla bot added the CLA Signed Signed Facebook CLA label Apr 3, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 3, 2026

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit e9e0088
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/69cf61ef59703d000891d83e
😎 Deploy Preview https://deploy-preview-11891--docusaurus-2.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 project configuration.

@slorber slorber added the Argos Add this label to run UI visual regression tests. See argos.yml GH action. label Apr 3, 2026
@slorber
Copy link
Copy Markdown
Collaborator

slorber commented Apr 3, 2026

Thanks for the PR, but this is not something we were looking to introduce. Please open an issue with a design proposal first to see if we want that feature.

If we introduce a tooltip system to Docusaurus, we'll do this globally in a comprehensive way across the whole theme.

We'll likely do this in the future, using modern CSS such as anchor positioning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants