Skip to content

Let comment text be selected and copied from an open card - #84

Merged
kylemcd merged 3 commits into
mainfrom
80-cant-select-text-in-comments
Sep 22, 2026
Merged

kylemcd merged 3 commits into
mainfrom
80-cant-select-text-in-comments

Conversation

@kylemcd

@kylemcd kylemcd commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #80.

Obsidian sets user-select: none on body and turns it back on only for note content, so comment cards inherited it and their text couldn't be selected anywhere. This fix is CSS only: an open card's comment text opts back in, with -webkit-user-select for iOS. Card behavior is unchanged from main.

  • Open cards only. Pressing a closed card opens it, which rebuilds it and focuses the reply field, so a drag couldn't start there anyway. Pressing an open card does neither, so a drag selects normally.
  • Overshooting drags. In Reading view the margin comes after the note, so selectable text on every card would pull every paragraph in between into a drag that overshot onto one. Pressing in the note closes an open card before the drag starts, and closed cards aren't selectable.
  • Placeholder. The "Empty" placeholder stays unselectable.

An earlier version on this branch changed when cards open, from press to release. That caused several regressions, so it has been reverted.

Verified in Obsidian with real mouse input:

  • In the Live Preview margin, open cards support drag, double-click and triple-click, and Cmd+C copies the selection.
  • Dragging in an open card selects text in Reading view and the sidebar too.
  • In Reading view, a drag from the note that overshoots onto an open or closed card stops at the end of its paragraph.

One new style test and one card test. The card test pins that pressing an open card doesn't rebuild its text or move focus. 287 tests pass.

Obsidian turns text selection off for its whole UI and back on only for
note content, so comment cards inherited user-select: none. Cards also
opened on mousedown, which rebuilt the card under the pointer and focused
the reply field, discarding any selection before a drag could make one.

Comment text now opts back into selection, and a card opens on click
instead, unless that click ended a new selection inside the card.

Closes #80.
Fixes regressions from opening cards on click:

- Pressing a card closes any open card above it, and the stack shifts
  before the button comes up, so the click landed on the column and the
  card never opened. The card now decides on mousedown and opens on the
  next mouseup anywhere. A dragstart or a new press stops the wait.
- Pressing a button and sliding off it opened the card, because the
  click's target was the common ancestor. The exclusions are checked
  against the press target again.
- The Empty placeholder's click handler stopped propagation, so its
  highlight no longer flashed. A press on it goes through the card again.
- With comment text always selectable, a Reading view drag that
  overshot onto a card ran through the rest of the note. Text is now
  selectable only once a press starts in its card.
Replaces the release-based card opening from the previous two commits.
Changing when a card opens caused a string of regressions: cards below
an open one, buttons pressed and slid off, the Empty placeholder, and
clicks with a pixel of wobble.

Cards open on press again, exactly as on main. Pressing an open card
doesn't rebuild it or move focus, so its text only needed to opt back
into selection. Scoping that to open cards also keeps a Reading view
drag through the note from running into a card: pressing in the note
closes an open card before the drag starts.
@kylemcd kylemcd changed the title Let comment text be selected and copied Let comment text be selected and copied from an open card Sep 22, 2026
@kylemcd
kylemcd marked this pull request as ready for review September 22, 2026 18:54
@kylemcd
kylemcd merged commit 99cf4ff into main Sep 22, 2026
1 check passed
@kylemcd
kylemcd deleted the 80-cant-select-text-in-comments branch September 22, 2026 18:54
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.

Can't select text in comments

1 participant