Repository navigation
feat(theme): align the popover recipes with Open Components - #369
Merged
alexgrozav merged 2 commits intoOct 29, 2026
Merged
Conversation
Popovers need to open in the top layer beside their trigger, flip when there's no room, fit the screen and keep their edge in every contrast mode, the way the Open Components Popover page's reference CSS does. The popover and its arrow gain a placement axis, top by default, the side the arrow pointed from before. On an element with the popover attribute, the setup callback positions it with position: fixed, inset: auto, the new popover.offset margin, position-area from placement and position-try-fallbacks with three @position-try rules, and fades it in only without a reduced-motion preference. Every other element keeps position: relative. The panel never outgrows the screen less spacing.xl and wraps long words, and its body scrolls. More contrast and forced colours draw its edge as an outline, since the colour compounds' border classes come after the base modifier classes. The arrow draws in currentColor, turns with placement through logical properties, sits on the facing edge in the top layer, and steps aside in forced colours, which would fill its transparent sides.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The browser's own [popover] padding inset the header and footer of a top-layer popover, so their separators stopped short of the panel's edges. The panel now resets it. A top-layer arrow goes first in the panel, so the header drops its top separator after a leading arrow too. The popover/top-layer, popover/points-at-trigger, popover/edge and popover/reduced-motion tests now assert the offset margin and its default, every triangle's widths and offsets, the arrow's centring, borders that differ from their background, and the @starting-style block. The docs page states the 0.375rem arrow default, shows the anchoring selectors and the arrow's place in the panel, and the stories keep their ids apart on the docs page.
7 of 13 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Aligns the popover recipes with the Open Components Popover page's stylesheet rules, positioning included, the way the page's reference CSS does it.
usePopoverRecipeandusePopoverArrowRecipegain aplacementaxis (top,bottom,start,end), defaulting totop, the side the arrow pointed from before.popoverattribute, the setup callback opens it in the top layer:position: fixed,inset: auto, the new@popover.offsetvariable as margin,position-areafromplacement,position-try-fallbackswith the reference values, and the--popover-fit,--popover-fit-belowand--popover-fit-above@position-tryrules. It fades in only underprefers-reduced-motion: no-preference. Every other element keepsposition: relative, the inline Storybook examples included.@spacing.xl, wraps long words, and its body scrolls. Under&:contrast-moreand&:forced-colorsit draws a full-strength orCanvasTextedge.currentColor, turns withplacementthrough logical properties, sits on the edge facing the anchor inside a top-layer popover, and hides in forced colours mode.@popover.arrow.sizeis now0.375rem(6px at the default size).popoverContrast.test.tsover every colour and variant in both themes, new Storybook stories (top layer, placements, focus) without inline styles, and an Accessibility section on the docs page.Related issue
Part of the work to align component styles with Open Components.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
pnpm build:nodocs,pnpm lint(no warnings in touched files), the theme package'stypecheck,test(3688 tests) andbuild, oxfmt and oxlint on the touched files,pnpm build:docswithtest:build, the Storybook build, and Storybook'svue-tsc -p tsconfig.app.json(18 errors, the same as the base). The rootpnpm typecheckandpnpm testdidn't run, since only the theme package and its stories changed.main, so CI runs on the integration PR.popover/edgefor thesoftvariant. A border would makesoftlook the same assubtle, which removes the difference between two axis values, sosoftkeeps its shadow and background only. More contrast and forced colours still draw its edge.border-colorclasses are emitted after the base modifier classes at the same specificity, so aborder-colorunder&:contrast-moreloses. The edge is an outline drawn over the border instead.CanvasText, which draws a block, so the arrow hides there and the panel's edge marks it.placementfrom a script. Scripted positioning (popover/fallback-position) is out of scope.