core icon indicating copy to clipboard operation
core copied to clipboard

Need a way to copy selected text without requring focus

Open rcoreilly opened this issue 8 months ago • 2 comments

Describe the bug

Currently, the copy shortcut (e.g., Ctrl-C or Command-C) is only processed by widgets that have focus. This is not intuitive and many times I think I've copied something but I haven't because of this constraint. We probably need a special mechanism for this specific shortcut, if the event is not handled by the focused widget or there is no focused widget, to look for something with a selection. One issue is that the main types that support text selection (Text, TextField, Editor) do not advertise this fact in any standard way, and states.Selected is probably not the appropriate mechanism.

How to reproduce

see above

Example code


Relevant output


Platform

macOS

rcoreilly avatar Mar 19 '25 19:03 rcoreilly

@rcoreilly i guess it should work in more traditional way.

For instance, if i select some text in a browser window, a selection has violet color. When a browser window loses focus, a selection is grayed out.

In case of the core here i see following troubles:

  • a cursor is blinking when ui is not focused;
  • selection color remains the same.

AnyCPU avatar Mar 20 '25 08:03 AnyCPU