Skip to content

feat(popover): position with CSS anchor positioning - #3614

Draft
jpzwarte wants to merge 3 commits into
mainfrom
feature/3602-popover-refactoring
Draft

feat(popover): position with CSS anchor positioning#3614
jpzwarte wants to merge 3 commits into
mainfrom
feature/3602-popover-refactoring

Conversation

@jpzwarte

Copy link
Copy Markdown
Member

Closes #3602

Replace the floating-ui based positioning with CSS anchor positioning. The browser now keeps the popover in place and flips it to the opposite side when there is not enough room, so the per-frame repositioning loop is gone.

The position property is reflected as an attribute so all twelve positions can be styled from CSS, and the offset, arrow padding and viewport margin moved from static JS properties to the --_offset, --_arrow-padding and --_viewport-margin custom properties. Room for the arrow is reserved next to the anchor, on top of the offset.

The popover also anchors itself to the element that invoked it, either via popovertarget or via the source passed to showPopover()/togglePopover(), and the anchor can now be set up entirely from CSS with anchor-name / position-anchor. Infotip uses that to anchor its popover to the trigger button in its own shadow root.

Supersedes #3603, which GitHub closed when the branch was renamed from feat/3602-popover-refactoring to feature/3602-popover-refactoring.

Replace the floating-ui based positioning with CSS anchor positioning. The
browser now keeps the popover in place and flips it to the opposite side when
there is not enough room, so the per-frame repositioning loop is gone.

The `position` property is reflected as an attribute so all twelve positions can
be styled from CSS, and the offset, arrow padding and viewport margin moved from
static JS properties to the `--_offset`, `--_arrow-padding` and
`--_viewport-margin` custom properties. Room for the arrow is reserved next to
the anchor, on top of the offset.

The popover also anchors itself to the element that invoked it, either via
`popovertarget` or via the `source` passed to `showPopover()`/`togglePopover()`,
and the anchor can now be set up entirely from CSS with `anchor-name` /
`position-anchor`. Infotip uses that to anchor its popover to the trigger button
in its own shadow root.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 43f86a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sl-design-system/popover Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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.

[Popover] Refactor to use CSS Anchor Positioning

1 participant