Cmd\Ctrl Drag in Source mode over external links should select the text not open the link

Steps to reproduce

  1. have a file with some links in it and be in “source” editing mode
  2. start dragging a selection across part of the URL text
  3. depress the command key
  4. release the mouse button (keep ⌘ key pressed as if you are going to press ⌘C)

Expected result

Nothing should happen when you release the mouse button after the drag, text should remain selected

Actual result

Browser opens

Environment

  • Operating system: macOS 13.2.1
  • Debug info:
SYSTEM INFO:
	Obsidian version: v1.1.15
	Installer version: v1.1.15
	Operating system: Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103 22.3.0
	Login status: logged in
	Catalyst license: insider
	Insider build toggle: on
	Live preview: off
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 13
	Restricted mode: off
	Plugins installed: 46
	Plugins enabled: 28
		1: Chronology v1.1.4
		2: Commander v0.4.9
		3: Copy document as HTML v0.4.0
		4: Copy Image and URL context menu v1.4.0
		5: Dataview v0.5.55
		6: Editor Commands Remap v1.0.2
		7: Find orphaned files and broken links v1.8.0
		8: GPT-3 Notes v0.2.5
		9: Hotkey Helper v0.3.15
		10: Janitor v1.0.7
		11: Advanced URI v1.33.0
		12: Image Toolkit v1.3.1
		13: QuickShare v1.3.1
		14: Reset Font Size v1.0.2
		15: Share as Gist v1.2.0
		16: Smart Typography v1.0.18
		17: Sort & Permute lines v0.7.0
		18: Split Pane View Helper v1.0.3
		19: Omnisearch v1.11.1
		20: Recent Files v1.3.5
		21: Settings Search v1.3.6
		22: Advanced Tables v0.18.1
		23: Tag Wrangler v0.5.6
		24: Templater v1.16.0
		25: Text Extractor v0.4.2
		26: Hot Reload v0.1.10
		27: Debug Log v1.2.0
		28: Image Captions v1.0.7

Additional information

I tested and repro’d this bug from the Sandbox vault as well.

Here’s a repro video (slowed down 3x so it’s easier to follow)

I don’t consider this a bug. Sorry.

@WhiteNoise What would you consider it then? It’s not normal behavior. Even Chrome itself doesn’t do this.

Not helpful to you, I suspect, but I can’t replicate this using the trackpad on my MBP (I don’t have a mouse to test with).

Long shot, but could it be a setting specific to the mouse rather than Obsidian? Anything in terms of sticky keys and accessibility that might trigger the open command?


For anyone else who wants to try this, here is the text I tested with (use ‘paste and match style’ to preserve the layout):

> [!success] Cmd+clicking a link opens a browser
> When you ⌘command-click on a link, it opens in the default browser… So far so good.

- [Google](https://google.com/) 
- [Microsoft](https://microsoft.com/)
- [ChatGPT](https:chat.openai.com/chat)

> [!bug] BUT... (here's the bug)
> if you press the <kbd>⌘</kbd> key *ahead of time* (e.g. in preparation for copying <kbd>⌘C</kbd> and then drag the selection across some text with the mouse, as soon as you release the left mouse button, Obsidian will launch the browser anyway 
> 
> This is contrary to the expected behavior and the way all other apps operate on macOS
> 
> The “launch browser” action should only be triggered on a single Cmd+click, not at the end of a drag/select  

[Obsidian](https://obsidian.md/)

@anon63144152 I have an Apple trackpad too and just tested it - easily replicated the problem. So it’s not a trackpad vs mouse thing. I don’t have any special Accessibility settings configured. Are you sure you followed the steps exactly?

  1. start dragging across selection of text that’s part of a link
  2. while you still have the “button” or “pad” depressed, press and hold the command key
  3. continue dragging, and then release the mouse/trackpad button (don’t let go of the command key)

This only happens in source mode, in LP you would drag the link to copy it. I moved this back to Bug Reports but it’s low priority issue.

The first post says to press the command key first and then start dragging:

  1. have a file with some links in it
  2. depress the command key
  3. start dragging a selection across part of the URL text
  4. release the mouse button (keep ⌘ key pressed as if you are going to press ⌘C)

The second post says to start dragging first and then press the command key:

  1. start dragging across selection of text that’s part of a link
  2. while you still have the “button” or “pad” depressed, press and hold the command key
  3. continue dragging, and then release the mouse/trackpad button (don’t let go of the command key)

Neither of those trigger the browser (Safari) to launch. This is what I see: the first with CMD pressed before dragging, and the second starting with dragging and then pressing CMD.

cmd drag url source mode obsidian

Seems WhiteNoise can reproduce this, so I must be doing something different.

@anon63144152 I updated the top post to clarify. Are you in “source” mode? (you need to be) That’s probably why