profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Can't focus the source view, Cmd+C is still handled by the call tree

Open mstange opened this issue 3 years ago • 1 comments

Steps to reproduce:

  1. Open https://share.firefox.dev/3qwevPb
  2. Select some text in the source view
  3. Press Cmd+C / Ctrl+C to copy the text.

Expected results: The selected text should be copied.

Actual results: The name of the selected function in the call tree is copied instead. The call tree remains focused and overrides the copy action.

mstange avatar Mar 23 '22 15:03 mstange

It looks like we can focus by clicking the sourceview's title (where the file name is), and then we can copy the file content just fine. Therefore maybe the click inside the source view's file content part is swallowed (canceled) somewhere?

julienw avatar May 30 '22 12:05 julienw

Therefore maybe the click inside the source view's file content part is swallowed (canceled) somewhere?

It looks like CodeMirror has its own call to .focus() inside its mousedown handler, and then it calls preventDefault() on the mousedown event.

However, the .focus() call isn't doing anything, because we're calling it on a non-focuseable element: We're calling focus() on the .cm-content div, which doesn't have a tabindex attribute. And it doesn't have a tabindex attribute because we set the CodeMirror editor's editable property to false, and according to the docs of readOnly, a non-editable editor is also non-focusable.

If I set editable to true, we get a blinking caret, which is undesirable.

I'll file an issue to ask for focusability without editability.

mstange avatar Oct 04 '22 23:10 mstange