Skip to content

Proposal: Global CSS Anchor Positioning Tooltip System #11894

@Injora

Description

@Injora

Have you read the Contributing Guidelines on issues?

Motivation

Currently, the Docusaurus classic theme relies on native browser tooltips (via the title attribute) for elements like the ColorModeToggle, navbar items, and action buttons. These native tooltips have a built-in OS delay, cannot be styled to fit the Infima theme, and disrupt the premium interactive feel of modern documentation sites.

Following feedback from @slorber on PR #11891, I am proposing the introduction of a comprehensive, global Tooltip system to Docusaurus using modern CSS—specifically the CSS Anchor Positioning API—to replace native tooltips across the whole theme.

Proposed Architecture

1. CSS Anchor Positioning API
To avoid expanding the JavaScript bundle with heavy positioning libraries like Floating UI or Popper.js, we can tether the tooltip to its trigger element using the CSS Anchor Positioning API. This keeps the framework lean while delivering robust, responsive positioning.
(Note: As Anchor Positioning is still gaining baseline support, a gracefully degraded CSS fallback would be included for unsupported browsers).

2. Component API
Introduce a headless, reusable <Tooltip> component in docusaurus-theme-common and a beautifully styled implementation in docusaurus-theme-classic.

Example concept:

import Tooltip from '@theme/Tooltip';

<Tooltip text="Switch between dark and light mode" placement="bottom">
  <ColorModeToggle />
</Tooltip>


### Self-service

- [x] I'd be willing to do some initial work on this proposal myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue is a proposal, usually non-trivial changestatus: needs triageThis issue has not been triaged by maintainers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions