feat(hover-card): support inline positioning#3131
Draft
segunadebayo wants to merge 7 commits into
Draft
Conversation
🦋 Changeset detectedLatest commit: 9ab01de The changes in this PR will be included in the next version bump. This PR includes changesets to release 86 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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.inlineenables 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 typecheckpnpm --filter @zag-js/hover-card typecheckpnpm exec vitest packages/utilities/popper packages/machines/hover-card --run --passWithNoTestspnpm --filter @zag-js/popper lintpnpm --filter @zag-js/hover-card lintpnpm --filter @zag-js/popper buildpnpm --filter @zag-js/hover-card buildpnpm buildhttp://localhost:3000/hover-card/inline-positioningwith 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.pnpm --filter ./examples/next-ts typecheckfails on existing unrelated TypeScript errors across other example/package files.pnpm exec eslint examples/next-ts/pages/hover-card/inline-positioning.tsx shared/src/routes.ts packages/utilities/popper/src/get-anchor.tsfails becauseexamples/next-ts/eslint.config.mjsimports missing package@eslint/eslintrcin this environment.