Skip to content

feat(hover-card): support inline positioning#3131

Draft
segunadebayo wants to merge 7 commits into
mainfrom
cursor/hover-card-inline-positioning-4187
Draft

feat(hover-card): support inline positioning#3131
segunadebayo wants to merge 7 commits into
mainfrom
cursor/hover-card-inline-positioning-4187

Conversation

@segunadebayo

@segunadebayo segunadebayo commented May 21, 2026

Copy link
Copy Markdown
Member

Closes #

📝 Description

Add inline positioning support for hover cards and expose the shared popper inline positioning option.

⛳️ Current behavior (updates)

Hover card positioning uses the trigger element's bounding box, which can feel detached when the trigger is inline text wrapping across multiple lines. Zag's popper anchor wrapper also did not expose client rects needed by Floating UI's inline middleware.

🚀 New behavior

positioning.inline enables Floating UI inline middleware. Hover cards pass the pointer coordinates that opened the trigger so the selected inline rect matches the hovered text line, and popper virtual anchors expose client rects for inline references.

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Added a changeset, documented the hover card option, and added a Next.js example for wrapped inline text at /hover-card/inline-positioning.

✅ Verification

  • pnpm --filter @zag-js/popper typecheck
  • pnpm --filter @zag-js/hover-card typecheck
  • pnpm exec vitest packages/utilities/popper packages/machines/hover-card --run --passWithNoTests
  • pnpm --filter @zag-js/popper lint
  • pnpm --filter @zag-js/hover-card lint
  • pnpm --filter @zag-js/popper build
  • pnpm --filter @zag-js/hover-card build
  • pnpm build
  • Browser-tested http://localhost:3000/hover-card/inline-positioning with Playwright Chromium. Confirmed the trigger renders as two disjoint inline rects, hover card opens without browser errors, and the position changes when entering each wrapped fragment. Captured and visually checked screenshots for initial, first-line hover, and second-line hover states.

⚠️ Verification notes

  • pnpm --filter ./examples/next-ts typecheck fails on existing unrelated TypeScript errors across other example/package files.
  • Direct pnpm exec eslint examples/next-ts/pages/hover-card/inline-positioning.tsx shared/src/routes.ts packages/utilities/popper/src/get-anchor.ts fails because examples/next-ts/eslint.config.mjs imports missing package @eslint/eslintrc in this environment.
Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented May 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9ab01de

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

This PR includes changesets to release 86 packages
Name Type
@zag-js/hover-card Patch
@zag-js/popper Patch
@zag-js/cascade-select Patch
@zag-js/color-picker Patch
@zag-js/combobox Patch
@zag-js/date-picker Patch
@zag-js/floating-panel Patch
@zag-js/menu Patch
@zag-js/popover Patch
@zag-js/select Patch
@zag-js/tooltip Patch
@zag-js/tour Patch
@zag-js/anatomy-icons Patch
@zag-js/anatomy Patch
@zag-js/core Patch
@zag-js/docs Patch
@zag-js/preact Patch
@zag-js/react Patch
@zag-js/solid Patch
@zag-js/svelte Patch
@zag-js/vanilla Patch
@zag-js/vue Patch
@zag-js/accordion Patch
@zag-js/angle-slider Patch
@zag-js/async-list Patch
@zag-js/avatar Patch
@zag-js/carousel Patch
@zag-js/checkbox Patch
@zag-js/clipboard Patch
@zag-js/collapsible Patch
@zag-js/date-input Patch
@zag-js/dialog Patch
@zag-js/drawer Patch
@zag-js/editable Patch
@zag-js/file-upload Patch
@zag-js/image-cropper Patch
@zag-js/listbox Patch
@zag-js/marquee Patch
@zag-js/navigation-menu Patch
@zag-js/number-input Patch
@zag-js/pagination Patch
@zag-js/password-input Patch
@zag-js/pin-input Patch
@zag-js/presence Patch
@zag-js/progress Patch
@zag-js/qr-code Patch
@zag-js/radio-group Patch
@zag-js/rating-group Patch
@zag-js/scroll-area Patch
@zag-js/signature-pad Patch
@zag-js/slider Patch
@zag-js/splitter Patch
@zag-js/steps Patch
@zag-js/switch Patch
@zag-js/tabs Patch
@zag-js/tags-input Patch
@zag-js/timer Patch
@zag-js/toast Patch
@zag-js/toc Patch
@zag-js/toggle-group Patch
@zag-js/toggle Patch
@zag-js/tree-view Patch
@zag-js/store Patch
@zag-js/types Patch
@zag-js/aria-hidden Patch
@zag-js/auto-resize Patch
@zag-js/collection Patch
@zag-js/color-utils Patch
@zag-js/utils Patch
@zag-js/date-utils Patch
@zag-js/dismissable Patch
@zag-js/dom-query Patch
@zag-js/file-utils Patch
@zag-js/focus-trap Patch
@zag-js/focus-visible Patch
@zag-js/highlight-word Patch
@zag-js/hotkeys Patch
@zag-js/i18n-utils Patch
@zag-js/interact-outside Patch
@zag-js/json-tree-utils Patch
@zag-js/live-region Patch
@zag-js/rect-utils Patch
@zag-js/remove-scroll Patch
@zag-js/scroll-snap Patch
@zag-js/stringify-state Patch
svelte-kit-starter Patch

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

@vercel

vercel Bot commented May 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
zag-nextjs Ready Ready Preview May 21, 2026 12:33am
zag-solid Ready Ready Preview May 21, 2026 12:33am
zag-svelte Ready Ready Preview May 21, 2026 12:33am
zag-vue Ready Ready Preview May 21, 2026 12:33am
zag-website Ready Ready Preview May 21, 2026 12:33am

Request Review

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.

2 participants