Skip to content

fix(docs): keep selection menus inside the editor - #585

Closed
imshashank wants to merge 3 commits into
mainfrom
codex/fix-doc-popover-multiline
Closed

imshashank wants to merge 3 commits into
mainfrom
codex/fix-doc-popover-multiline

Conversation

@imshashank

Copy link
Copy Markdown
Contributor

Continues #581 and preserves its original contributor commit and review context. The selection toolbar stays inside the editor box and uses the final selected line when it must appear below a multiline selection.

The added component regression uses distinct endpoint coordinates. It fails at 28px before the repair and passes at 92px after the repair. Existing centering, edge clamping, and short-editor behavior remain covered.

Validation: frozen install, bun run verify passed with 7,032 tests and no failures or skips. The editor file passed all 32 tests. A local real-Chrome fixture using the shipped CSS passed in light and dark themes, placing the toolbar exactly 8px below the final selected line and 8px inside the editor edge.

This draft is ready for independent source review and fresh exact-head CI. The original PR remains open until this replacement actually lands.

Fixes #515

ayam04 and others added 3 commits November 16, 2026 08:33
The formatting popover was anchored at the selection midpoint, shifted left by
half its own width through a CSS transform, and pinned 44px above the selection
top. Neither axis was bounded, and the surface scrolls inside an overflow
container, so a selection starting at the left edge of the narrow drawer put
roughly half the popover outside it, and a selection on the first line put the
popover above the box entirely (#515).

The popover now measures itself after mount, centres on the selection only where
the result fits, clamps into the editor box otherwise, and flips below the
selection when there is no room above it. The placement rule is a pure exported
helper, so the reported geometry is a unit test.

Verified:
- bun test tests/features/docs/editor/rich-text-editor.test.tsx: 31 passed
- bun test tests/features/docs: 487 passed, 3 failed, and the same three fail on
  a clean main checkout (useAutosave x2 under full-suite timing, and the outline
  memo setext underline case), so they are pre-existing
- RED both ways: restoring the pre-fix arithmetic fails the six placement tests
  and both component tests; restoring only the pre-fix rendering fails the two
  component tests (left 12px instead of 8px, top -40px instead of 28px)
- biome check, check-comments, check-bytes and check-deps are clean
- apps/web tsc --noEmit names neither touched file (the checkout reports
  pre-existing errors elsewhere)

Fixes #515

Signed-off-by: ayam04 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Contributor Author

Incorporated into main by #586 at 11332e2. The final editor fix includes multiline selection placement and retained-selection resize handling, with real Chrome light/dark verification and 33 editor tests. The combined release passed 7,056 tests, all six CI jobs, CodeQL, links and preview checks. Original contributor history and ayam04 co-author credit are preserved in the squash commit. Closing as incorporated; production promotion is tracked separately.

@imshashank imshashank closed this Nov 16, 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.

[bug]: editor popover overflows in drawer

2 participants