theia
theia copied to clipboard
Terminal improperly handles paste events (Linux)
Bug Description:
In the Electron application on Linux, a terminal will inappropriately handle a paste command directed at the navigator. I cannot reproduce the behavior on MacOS.
Steps to Reproduce:
- Open the navigator widget.
- Open a terminal widget and focus it.
- Use the context menu copy command on a file node in the navigator tree
- Use the context menu paste command on a folder node in the navigator tree
- Observe that the URI of the file is pasted in the terminal widget, and the file is not pasted in the folder.
Additional Information
The problem seems due to our use of the document.execCommand
API. When the terminal widget is focused, it creates a textarea
element to handle input, and when we use the execCommand
method to execute a paste
action, the textarea
is prioritized to handle the event since it is editable, and xterm
's event handler calls stopPropagation
. Setting the contenteditable
property on the navigator widget's node
to 'true'
allows it to be prioritized over the terminal's input and fixes the bad behavior, but doesn't seem like the right move.
- Operating System: Ubuntu 20.04 & RHEL7, Electron application
- Theia Version:
master
(37ed897594a709d7e0a10d3db4c3bba85f00878a)
Related: https://github.com/eclipse-theia/theia/issues/2171