Skip to content

feat(theme): align the tooltip recipes with Open Components - #376

Merged
alexgrozav merged 2 commits into
align-component-styles-uxf-487from
align-tooltip-styles-uxf-501
Oct 29, 2026
Merged

alexgrozav merged 2 commits into
align-component-styles-uxf-487from
align-tooltip-styles-uxf-501

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

Description

Brings the tooltip and tooltip-arrow recipes in line with the Open Components Tooltip standard, for every rule a stylesheet decides.

  • Top layer and flipping. On an element with the popover attribute, useTooltipRecipe sets position: fixed, inset: auto and the new @tooltip.offset margin, hides the tooltip while it's closed, and places it with position-area from a new placement axis (top by default, then bottom, start and end). position-try-fallbacks: flip-block, flip-inline flips it when there's no room. All of this is scoped to .tooltip[popover] in the setup callback, so every other use keeps today's output and the @z-index.tooltip layer.
  • Arrow. useTooltipArrowRecipe gets the same placement axis. It draws its triangle in color, uses logical properties, and sits centred on the edge that faces the trigger inside a top-layer tooltip. The default top geometry and the colour of every compound stay the same.
  • Wrapping. The content now wraps at 32ch rather than 240px, with overflow-wrap: anywhere, so a long word breaks inside the box.
  • Motion. A top-layer tooltip fades and grows in from @starting-style. Under prefers-reduced-motion: reduce it only fades.
  • Forced colours. The content takes Canvas and CanvasText, and its border marks the edge, the soft variant's included. The border-drawn arrow hides.
  • Contrast. tooltipContrast.test.ts checks the text of all 9 colour × variant compounds in both themes. The lowest is 7.2:1.

Storybook gets TopLayer, Placements and Focus stories, and the inline styles in the freeform example are gone. The docs page gets an Accessibility section.

Related issue

None.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes (ran pnpm build:nodocs, plus the touched packages' checks: theme typecheck and its full suite of 3676 tests, oxfmt and oxlint on the touched files, the Storybook build with vue-tsc, and the docs build with test:build. I didn't run the root-wide lint, typecheck or test)
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope (it targets the integration branch align-component-styles-uxf-487, which goes to main as one PR)

Notes / screenshots

  • The arrow after a flip. tooltip/points-at-trigger also asks the arrow to follow the tooltip when a fallback flips it. CSS can't tell which fallback was chosen, so a script has to set the arrow's placement, as the reference implementation does with data-side. The docs say so. An @container anchored(fallback: …) query does it in CSS in Chrome, but Vite's lightningcss minifier can't parse it and fails the build, so it isn't used.
  • Reduced motion in Storybook. The global preset sets transition-duration: 0s under reduced motion, so there the fade is instant too.
  • tooltip/fallback-position needs script, so it's out of scope here.

Open a tooltip with the popover attribute in the top layer, place it with a new placement axis and CSS anchor positioning, and flip it when there's no room. Wrap the content at 32ch, keep its edge in forced colours mode, and only fade it in under reduced motion. The arrow turns with placement and sits on the edge that faces the trigger.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
styleframe-dev Ready Ready Preview Oct 29, 2026 6:23pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 6:23pm UTC

Request Review

Assert each placement of the arrow whole, so a second coloured side, a dropped fill or a moved inset fails. Show the anchoring CSS in the docs, say that the width changed, and keep the stories' ids and anchor names unique on the docs page.
@alexgrozav
alexgrozav merged commit cd43c2a into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the align-tooltip-styles-uxf-501 branch October 29, 2026 19:12

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — d4bd3257 Deployed Oct 29, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — d4bd3257 Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant