Skip to content

feat(theme): align the popover recipes with Open Components - #369

Merged
alexgrozav merged 2 commits into
align-component-styles-uxf-487from
popover-open-components-uxf-497
Oct 29, 2026
Merged

alexgrozav merged 2 commits into
align-component-styles-uxf-487from
popover-open-components-uxf-497

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

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.

  • usePopoverRecipe and usePopoverArrowRecipe gain a placement axis (top, bottom, start, end), defaulting to top, the side the arrow pointed from before.
  • On an element with the popover attribute, the setup callback opens it in the top layer: position: fixed, inset: auto, the new @popover.offset variable as margin, position-area from placement, position-try-fallbacks with the reference values, and the --popover-fit, --popover-fit-below and --popover-fit-above @position-try rules. It fades in only under prefers-reduced-motion: no-preference. Every other element keeps position: relative, the inline Storybook examples included.
  • The panel is never wider or taller than the screen less @spacing.xl, wraps long words, and its body scrolls. Under &:contrast-more and &:forced-colors it draws a full-strength or CanvasText edge.
  • The arrow draws in currentColor, turns with placement through logical properties, sits on the edge facing the anchor inside a top-layer popover, and hides in forced colours mode. @popover.arrow.size is now 0.375rem (6px at the default size).
  • Tests named by rule ID, a popoverContrast.test.ts over 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

  • 🐞 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
  • 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

Notes / screenshots

  • Checks run: pnpm build:nodocs, pnpm lint (no warnings in touched files), the theme package's typecheck, test (3688 tests) and build, oxfmt and oxlint on the touched files, pnpm build:docs with test:build, the Storybook build, and Storybook's vue-tsc -p tsconfig.app.json (18 errors, the same as the base). The root pnpm typecheck and pnpm test didn't run, since only the theme package and its stories changed.
  • Target: this PR targets the integration branch for the component alignment, not main, so CI runs on the integration PR.
  • Should rule declined: popover/edge for the soft variant. A border would make soft look the same as subtle, which removes the difference between two axis values, so soft keeps its shadow and background only. More contrast and forced colours still draw its edge.
  • Panel border at 3:1: not asserted. The Popover page calls the border decoration, since the title says what the popover is, so the contrast test checks text at 4.5:1.
  • Outline for the full-strength edge: the colour compounds' border-color classes are emitted after the base modifier classes at the same specificity, so a border-color under &:contrast-more loses. The edge is an outline drawn over the border instead.
  • Arrow in forced colours: Chrome forces the triangle's transparent sides to CanvasText, which draws a block, so the arrow hides there and the panel's edge marks it.
  • Flips: CSS can't tell which fallback was chosen, so a consumer that flips updates the arrow's placement from a script. Scripted positioning (popover/fallback-position) is out of scope.

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.
@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 2:52pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 2:52pm UTC

Request Review

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.
@alexgrozav
alexgrozav merged commit 467e7fb into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the popover-open-components-uxf-497 branch October 29, 2026 15:18

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — c3d13145 Deployed Oct 29, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — c3d13145 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