Skip to content

fix(annotate): place a box with calc() so a host's box-sizing reset can't shift it - #392

Merged
vite-hub[bot] merged 2 commits into
mainfrom
fix/annotate-box-host-box-sizing
Nov 9, 2026
Merged

vite-hub[bot] merged 2 commits into
mainfrom
fix/annotate-box-host-box-sizing

Conversation

@onmax

@onmax onmax commented Nov 9, 2026

Copy link
Copy Markdown
Owner

On a page that sets * { box-sizing: border-box } outside a layer, every box mark sits 6px up and left of its area and doesn't grow past it. Drop's document shell has that reset, so box marks on Drop docs have been off since it moved to comark-ui 0.8.2.

Since #230, a box pads itself out with .ca-mark.ca-box{box-sizing:content-box;padding:6px;margin:-6px}. That rule lives in @layer comark, and any unlayered rule beats a layered one, whatever its specificity. So the host's reset wins, the 12px of padding fold back inside the w% × h% box, and only the -6px margin stays.

This PR drops that rule and writes the room into the mark's inline geometry instead: left:calc(x% - 6px), width:calc(w% + 12px), and the same for top and height. The box has no padding or border, so box-sizing no longer changes where it lands. Charts still pass a padding of 0 and get plain percentages.

The new e2e test renders a box under that reset and checks its rect is the area plus 6px on each side. It fails on main (12px off) and passes here. I also rendered the Drop doc where I saw it with this build and the same reset: before/after.

…an't shift it

A box padded itself 6px out with content-box padding and a -6px margin in the comark layer. An unlayered
'* { box-sizing: border-box }', as Drop's document shell has, beats any layered rule, so the padding folded
back inside the box and the mark sat 6px up and left of its area. The renderer now writes the room into the
mark's left, top, width, and height with calc(), which box-sizing doesn't touch.
@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-09T09:10:52.336426Z
We couldn’t complete this review. Comment @codex review to try again.
2bf37ea 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.

@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 in the initial review of 2bf37ea, covering the annotate box geometry fix and its regression coverage.

  • Reset-resistant box geometry — Box clearance now uses inline calc() positioning and sizing, so an unlayered host box-sizing: border-box reset cannot fold the clearance inside the marked area.
  • Aligned placement behavior — The renderer uses the same boxPadding input as stamp placement, while chart annotations retain their zero-padding percentage geometry.
  • Regression coverage — Unit assertions cover default and chart geometry, and Playwright verifies the rendered rectangle under the overriding host reset.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub

vite-hub Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-11-09T10:37:55.213Z 5m 0s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

Ready; no repair needed. Pullfrog: no findings; Codex review unavailable due to quota. All supplied checks passed. Package-local `vp test run` passed annotate (72 tests) and charts (42). Focused `vp lint`, the Playwright host-reset regression, dependency builds, and `git diff --check` passed. Initial pnpm setup hooks failed in the sandbox; validation succeeded with automatic reinstall disabled. The checkout remains clean.

@pkg-pr-new

pkg-pr-new Bot commented Nov 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

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

comark-badge

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

comark-cards

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

comark-carousel

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

comark-cast

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

comark-charts

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

comark-chat

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

comark-chips

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

comark-cjk

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

comark-code

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

comark-code-notes

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

comark-colors

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

comark-comments

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

comark-critic

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

comark-deflist

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

comark-details

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

comark-diagrams

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

comark-diff

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

comark-embed

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

comark-fields

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

comark-figure

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

comark-file-tree

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

comark-footnotes

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

comark-github

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

comark-icon

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

comark-include

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

comark-keys

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

comark-links

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

comark-linter

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

comark-magic-move

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

comark-mark

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

markdown-it-to-comark

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

marked-to-comark

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

comark-mathml

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

comark-media

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

comark-metrics

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

migrate-to-comark

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

comark-outline

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

comark-properties

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

comark-qr

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

comark-quiz

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

comark-reading-time

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

remark-to-comark

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

comark-sources

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

comark-steps

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

comark-table

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

comark-tabs

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

comark-tests

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

comark-time

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

comark-ui

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

comark-xref

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

comark-zoom

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

commit: 600f206

@vite-hub
vite-hub Bot merged commit 81227e2 into main Nov 9, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the fix/annotate-box-host-box-sizing branch November 9, 2026 10:52
@github-actions github-actions Bot mentioned this pull request Nov 9, 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