fix: slash menu invisible in presentation mode#2018
Merged
harbournick merged 3 commits intosuperdoc-dev:mainfrom Feb 14, 2026
Merged
fix: slash menu invisible in presentation mode#2018harbournick merged 3 commits intosuperdoc-dev:mainfrom
harbournick merged 3 commits intosuperdoc-dev:mainfrom
Conversation
In presentation mode the ProseMirror view is hidden off-screen (left: -9999px), so view.coordsAtPos() returns coordinates in the hidden editor's space. Delegate to PresentationEditor.coordsAtPos() which computes visual layout coordinates instead. This was the root cause of the slash menu being positioned off-screen when triggered via "/" in presentation mode.
getRangeRects returns empty for collapsed selections on empty lines because there is no painted inline content to measure. Fall back to #computeCaretLayoutRect which combines DOM position data with layout metrics, then convert to viewport coordinates via denormalizeClientPoint.
Two fixes for slash menu positioning: - Add fallback when coordsAtPos returns null (e.g. blank document before first layout): position the menu at the top-left of the visible editor surface instead of leaving coordinates at (0,0) which ends up off-screen after containing-block adjustment. - Set MENU_OFFSET_X to 0 so the menu aligns with the cursor position. The previous 100px offset was never noticed because the menu was invisible in presentation mode.
Collaborator
|
@asumaran thanks for the PR! It looks good. It is still in 'draft' state - is that actually the case or do you want to mark it ready for review? thank you! |
Contributor
Author
|
@harbournick I believe this is ready to merge. The PR is still in draft because I was planing to run a few extra manual tests later, but since it’s already approved, feel free to merge if everything looks good on your side. |
harbournick
approved these changes
Feb 14, 2026
|
🎉 This PR is included in superdoc v1.13.0-next.11 The release is available on GitHub release |
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.

Problem
The slash menu (
/) was completely invisible in presentation mode (layout engine enabled). Pressing/would steal focus to the menu's hidden search input, blocking all typing, but the menu itself was rendered off-screen at ~left: -9900px.Root cause:
Editor.coordsAtPos()always used the ProseMirror view's coordinates, but in presentation mode the PM view is hidden off-screen (left: -9999px). The layout engine renders the visible content separately.Fixes #781
Changes
Editor.coordsAtPos: delegate toPresentationEditor.coordsAtPos()when available, which returns visual layout coordinates instead of hidden PM view coordinates.PresentationEditor.coordsAtPos: add caret geometry fallback via#computeCaretLayoutRect+denormalizeClientPointfor positions wheregetRangeRectsreturns empty (collapsed selections on empty lines).Slash menu plugin: add surface top-left fallback when
coordsAtPosreturns null (blank document before first layout). SetMENU_OFFSET_Xto 0 so the menu aligns with the cursor.Test plan
pnpm dev(layout engine ON by default)/, menu appears at top-left of editor/, menu appears at cursor positionpnpm test, all 5545 tests pass