Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middle pointer click uses primary instead of secondary selection (clipboard) #14430

Closed
sumpfralle opened this issue Jul 12, 2020 · 3 comments
Closed
Labels

Comments

@sumpfralle
Copy link

Description

The riot web client seems to override the window manager's handling of selections (primary, secondary, clipboard - see xsel manpage).

The default action of the middle pointer click event is paste from the secondary selection. Instead riot overrides this behavior and implements paste from the primary selection.

Steps to reproduce

  1. select some text (e.g. in a terminal or a web browser) and copy it to the clipboard (e.g. via the context menu or CTRL-C)
  2. select some text with the pointer, but do not copy it to the clipboard (e.g.: just select it with a double-click on a word)
  3. switch to the riot web client
  4. press the middle pointer button
  5. the content selected in step (1) is pasted into the message input field

What I expected instead: the content selected in step (2) being pasted.

Details

The window manager handles three selections: primary, secondary and clipboard.

riot seems to override the middle pointer click with paste from primary. All other applications leave the middle pointer click to the window manager (or some other layer). By default this event triggers a paste from secondary.

The current behavior is surprising and may lead to accidental information exposure, e.g. passwords recently acquired from the local password management application being entered (but not yet submitted) into riot's message input field.

Instead the riot client should let the desktop environment handle the middle pointer click event.

Workaround

  1. middle pointer click in a separate text editor (e.g. gedit)
  2. select the pasted text
  3. copy the selection to the primary clipboard
  4. perform a middle pointer click in riot's message input field

This is especially relevant for content copied from applications that do not support copy to clipboard directly (e.g. some terminals or visualization application).

Version information

  • Platform: web browser and revolt

For the web app:

@t3chguy
Copy link
Member

t3chguy commented Jul 12, 2020

riot-web is a webapp and any overriding would be done by the browser running it, whatever revolt is using in your case.

Riot does no such overriding for any clipboard paste events.
The web clipboard spec doesn't even have support for multiple selections: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText (and Riot doesn't use it as it has no reason to do custom clipboard reading)

@sumpfralle
Copy link
Author

sumpfralle commented Jul 12, 2020

I feel stupid now :(

Yes, indeed it happens only in revolt, not in a separate browser. My memory failed me here ...

Sorry for the noise.

PS: there is already an issue filed against revolt regarding this behavior: aperezdc/revolt#98

@Marenz
Copy link

Marenz commented Jul 8, 2022

The issue might still be one that can be solved here though.

I looked through various text field inputs and found that it works for all of them except the chat input.
The difference: All of the ones that work are <input..> based elements, whereas the text input is a <div> field.
I tried setting up a local element-web to change that div to input to try and test my theory.

Unfortunately so far I failed to set it up to test. Maybe someone here can?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants