fix: robust annotation editor positioning (degenerate rect guard, z-index, Esc close) - #2
Open
chenyuhao0628 wants to merge 2 commits into
Open
Conversation
- rectOf: reject detached/zero-size anchor rects (getBoundingClientRect returns zeros when the clicked node was detached mid-render, which made the editor clamp to the viewport top-left corner and cover the sidebar) - AnnotationEditor: fallback anchor position (lower-center of viewport) for degenerate rects; clamp both above/below branches into the viewport - give .dshq-editor and .dshq-toolbar an explicit high z-index so the close button can never be covered by other layers - global Escape now also closes the annotation editor (previously only via the input's own keydown) - selection toolbar: clamp below-branch so the bubble stays on-screen - extractTurnTexts / selectTurnQuote: try/catch so a malformed snapshot can never crash the turnTail entry and silently remove the buttons - registerSource: guard the duplicate-registration throw on hot reload so apply() cannot die halfway (global listeners + slot registration) - stage(): visible warning when no session is available instead of a silent no-op; sync currentSessionId from the turn-tail path so anchor jumps keep working after switching sessions
chenyuhao0628
force-pushed
the
fix/editor-positioning-robustness
branch
from
August 17, 2026 08:38
8c24ff7 to
1f162fa
Compare
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.
问题描述
选区批注/回合引用按钮点击后,悬浮编辑框偶尔会卡在视口左上角并盖住左侧会话列表,且
✕按钮点不掉:getBoundingClientRect()可能返回零尺寸矩形(按钮节点在点击与测量之间脱离 DOM),定位逻辑Math.max(12, ...)把编辑框钳制到左上角 (12, 8)。z-index(选区气泡/悬停提示都有2147483000),关闭按钮可能被其他层遮挡。修复内容
rectOf健壮化:节点已脱离 DOM(isConnected === false)或矩形为零尺寸时返回null,不再把脏矩形传给编辑框。fallbackRect:锚点矩形失效时,编辑框定位到视口下部居中(输入框上方),而不是左上角。estH修正为实际高度 236。z-index: 2147483000:.dshq-editor与.dshq-toolbar显式提升,✕永远可点。vh钳制,避免贴底选区把气泡推出屏幕。验证