fix(desktop): scope drag-selection to the conversation pane - #4272
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): scope drag-selection to the conversation pane#4272iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
In split view a drag-selection starting in the channel could escape into the thread (and vice versa), sweeping hover action bars, quick reactions, reaction pills, emoji pickers, and popovers into the copied range. The channel and thread panes now carry a data-selection-pane marker, the interactive chrome that must never be selected carries data-selection-exclude + select-none, and a useConversationSelectionScope hook on the shared conversation root listens for selectionchange and clamps the focus end back to the anchor pane boundary when a drag tries to escape it. Selections inside composers, inputs, contenteditables, and top-level dialogs/popovers are left untouched so typing, IME composition, and overlay interactions keep native behavior. Clamp decisions are pure functions in lib/selection/conversationSelectionScope.ts, covered by a structural-dom test suite so no jsdom is needed. Fixes block#4077 Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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.
Summary
Fixes #4077.
In split view, a native drag-selection starting in the channel could escape into the thread (and vice versa), sweeping hover action bars, quick reactions, reaction pills, emoji pickers, and popovers into the copied range.
Changes
data-selection-panemarker so the scope can resolve which pane a drag began in.data-selection-exclude+select-none.useConversationSelectionScopehook on the shared conversation root listens forselectionchange; once a drag is anchored to a pane, the moving end is clamped back to the pane boundary if it escapes — keeping message text copyable while containing the scope.lib/selection/conversationSelectionScope.ts) with a structural-DOM test suite (no jsdom needed).Test plan
pnpm exec tsc --noEmit— cleannode --import ./test-loader.mjs --experimental-strip-types --test "src/**/*.test.mjs"— 3930/3930 passconversationSelectionScope.test.mjs— 24/24 pass