Skip to content

feat(sources,ui): place the citation card and the props panel with CSS anchor positioning - #456

Merged
vite-hub[bot] merged 3 commits into
mainfrom
feat/k3-anchor-popovers
Nov 17, 2026
Merged

vite-hub[bot] merged 3 commits into
mainfrom
feat/k3-anchor-popovers

Conversation

@onmax

@onmax onmax commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

The citation card and the editor's props panel are popovers that a script places: place() reads the anchor's rect, measures the popover, and writes top and left, then does it again on every scroll and resize. The browsers comark-ui supports can now do this in CSS (anchor positioning shipped in Chrome 125, Firefox 147 and Safari 26), so the measuring can go where anchor positioning exists.

This PR moves both to CSS anchor positioning under @supports (anchor-name: --a) and keeps place() as the fallback:

  • Sources card. The open citation (data-cso-open) is the anchor. The card takes position-area: top, position-try-fallbacks: flip-block and justify-self: anchor-center, with margins that keep it 8px inside the viewport. Hover and focus still open it from the script, since interestfor is Chrome-only. The script only sets the transform origin now, so the card still grows from its citation.
  • Props panel. Each button names its own anchor inline (anchor-name: --cev-N) and its panel takes it. The panel opens below its button from its start, then flips above or to the button's end. With anchor positioning there are no scroll or resize listeners.
  • Panel height. The panel's cap goes from min(24rem, 80vh) to min(24rem, 50vh - 3.5rem). With the old cap, a block near the middle of a short window had no room for the panel on either side, so place() put it below and the bottom ran off the screen. Under half the viewport it always fits on one side.

Nothing is added to the inline scripts and there's no polyfill. A browser without anchor positioning runs the same place() as before.

e2e/anchor.ts checks the placement (above and centered, flipped at the top edge, 8px from either side, follows a scroll, panel flips, panel never covers its button) and runs in Chromium (anchor.e2e.ts) and Firefox 157 (anchor-firefox.e2e.ts). On main the CSS-only panel checks and the "placed by the browser" check fail. I also ran the same file in Playwright WebKit locally and it passes, but CI doesn't install WebKit, so it isn't committed.

Before/after in Chromium, Firefox and WebKit: on Drop

…S anchor positioning

The citation card and the editor's props panel are popovers placed by
CSS anchor positioning under @supports (anchor-name: --a), with the
script's place() kept for browsers without it. The props panel's height
stays under half the viewport, so it always fits on one side of its
button instead of running off the bottom.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T14:49:05.218634Z
We couldn’t complete this review. Comment @codex review to try again.
fcec146 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@456

comark-badge

pnpm add https://pkg.pr.new/comark-badge@456

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@456

comark-cards

pnpm add https://pkg.pr.new/comark-cards@456

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@456

comark-cast

pnpm add https://pkg.pr.new/comark-cast@456

comark-charts

pnpm add https://pkg.pr.new/comark-charts@456

comark-chat

pnpm add https://pkg.pr.new/comark-chat@456

comark-chips

pnpm add https://pkg.pr.new/comark-chips@456

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@456

comark-code

pnpm add https://pkg.pr.new/comark-code@456

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@456

comark-colors

pnpm add https://pkg.pr.new/comark-colors@456

comark-comments

pnpm add https://pkg.pr.new/comark-comments@456

comark-critic

pnpm add https://pkg.pr.new/comark-critic@456

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@456

comark-details

pnpm add https://pkg.pr.new/comark-details@456

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@456

comark-diff

pnpm add https://pkg.pr.new/comark-diff@456

comark-embed

pnpm add https://pkg.pr.new/comark-embed@456

comark-fields

pnpm add https://pkg.pr.new/comark-fields@456

comark-figure

pnpm add https://pkg.pr.new/comark-figure@456

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@456

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@456

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@456

comark-github

pnpm add https://pkg.pr.new/comark-github@456

comark-icon

pnpm add https://pkg.pr.new/comark-icon@456

comark-include

pnpm add https://pkg.pr.new/comark-include@456

comark-keys

pnpm add https://pkg.pr.new/comark-keys@456

comark-links

pnpm add https://pkg.pr.new/comark-links@456

comark-linter

pnpm add https://pkg.pr.new/comark-linter@456

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@456

comark-mark

pnpm add https://pkg.pr.new/comark-mark@456

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@456

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@456

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@456

comark-media

pnpm add https://pkg.pr.new/comark-media@456

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@456

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@456

comark-outline

pnpm add https://pkg.pr.new/comark-outline@456

comark-properties

pnpm add https://pkg.pr.new/comark-properties@456

comark-qr

pnpm add https://pkg.pr.new/comark-qr@456

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@456

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@456

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@456

comark-sources

pnpm add https://pkg.pr.new/comark-sources@456

comark-steps

pnpm add https://pkg.pr.new/comark-steps@456

comark-table

pnpm add https://pkg.pr.new/comark-table@456

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@456

comark-tests

pnpm add https://pkg.pr.new/comark-tests@456

comark-time

pnpm add https://pkg.pr.new/comark-time@456

comark-ui

pnpm add https://pkg.pr.new/comark-ui@456

comark-xref

pnpm add https://pkg.pr.new/comark-xref@456

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@456

commit: a410d81

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The capability gate disables working placement on older Chromium, and citation cards lose their position during dismissal.

Reviewed changes — Reviewed the CSS anchor-positioning migration for citation cards and editor props panels, including fallback behavior and regression coverage.

  • Citation cards: CSS places the shared popover above or below its active citation, while JavaScript retains dismissal and transform-origin handling.
  • Editor props panels: Per-button anchor names replace JavaScript placement where supported, with directional fallbacks and a smaller viewport-relative height cap.
  • Coverage and documentation: Shared Chromium/Firefox tests exercise placement, flipping, viewport clearance, and scrolling; sources documentation describes the new positioning.

Validation: all 27 focused Playwright tests and 24 focused parser, renderer, and editor tests passed. Full pnpm build ended with [timed out after 120000ms] near the final package; the sources and linter packages built successfully independently, including publint.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/sources/src/client.ts Resolved
Comment thread packages/sources/src/styles.ts Resolved
@vite-hub

vite-hub Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Starting Not started —
View session Cancelled 2026-11-17T15:51:26.565Z 9m 21s
View session Completed 2026-11-17T15:17:48.499Z 7m 54s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Pull request evidence changed.

View session

Pushed 126e4d3 fixing both findings and adding regression coverage. Six focused tests and lint passed; browser tests were blocked by sandbox EPERM on server startup. The exit-position thread was resolved; resolving the capability-gate thread failed twice with transport errors. Awaiting hosted checks and review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

No P0 or P1 findings remain, but the two new Firefox regression tests fail consistently and need correction before merging.

Reviewed changes — Reviewed 126e4d3, the fix commit since the previous Pullfrog review.

  • Tightened capability detection in both JavaScript and CSS so partial anchor-positioning implementations retain measured placement.
  • Retained citation anchors during dismissal, transferring the anchor on the next opening and removing it on teardown.
  • Added fallback and exit regressions to the shared Chromium/Firefox suite; both new cases currently fail in Firefox for test-specific reasons.

Validation: pnpm build and all 24 focused sources/editor tests passed. The focused browser suite passed 29 of 31 tests; both Firefox failures reproduced twice in isolation and also appear in the CI e2e job.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread e2e/anchor.ts Resolved
Comment thread e2e/anchor.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes — Reviewed a410d81, the Firefox regression-test fixes since the previous Pullfrog review.

  • Added standards-mode setup to the partial-support fixture so Firefox measures the full viewport when testing JavaScript placement.
  • Gated exit-transition geometry on overlay support while retaining anchor-preservation and anchor-transfer assertions in both browsers.

Validation: pnpm build passed; all 31 focused Playwright tests and 24 sources/editor tests passed. Repeating the two repaired cases three times in each browser also passed all 12 executions.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit 3c32cc2 into main Nov 17, 2026
7 checks passed
@vite-hub
vite-hub Bot deleted the feat/k3-anchor-popovers branch November 17, 2026 16:10
@github-actions github-actions Bot mentioned this pull request Nov 17, 2026
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