coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.88k stars 5.58k forks source link

[Bug]: Unable to paste - CMD+V. Macbook Pro M1 Max #6452

Closed sneighbors closed 2 months ago

sneighbors commented 1 year ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. Open code-server
  2. type some text
  3. highlight text
  4. cmd-x (cut the text)
  5. cmd-v (paste the text) Nothing happens

Expected

The text that was cut in step 4 should have been pasted

Actual

Nothing happens and the right click menu does not show a paste option

Logs

Not available from within Home Assistant from what I can tell

Screenshot/Video

image

Does this issue happen in VS Code or GitHub Codespaces?

Are you accessing code-server over HTTPS?

Notes

This is the port that is used with in Home Assistant maybe due to updated HA Code version that was installed as I was thinking this was working before.

code-asher commented 9 months ago

Sorry for the long delay for triaging. Does Home Assistant pull in code-server through an iframe? Do you see any error logs in the browser console? I wonder if it is missing the allow to make the clipboard API work (although not sure that is required for same-origin frames). Does it work if you open code-server directly without an iframe?

sneighbors commented 8 months ago

Just noticed when I opened today a little popup - so I'm guessing the paste function is what that is referring to. Makes it kind of pointless when you are using this to make edits to scripts and other yaml files for configuring Home Assistant.

image

But having tried today to reproduce it no longer reproducible. I'm able to cut/copy/paste at least in the one scripts.yaml file I opened.

code-asher commented 8 months ago

Ahh yeah browsers only allow access to the clipboard API over secure contexts; as a tangent we need to remove that wishy-washy popup and show a more concrete message when there is actually a failed attempt to use APIs restricted by the browser.

In any case, I think Microsoft must have reworked things not to use the clipboard API, because I experimented a bit just now and even after disabling the clipboard API copy/paste is still working for me, and I am pretty sure that was not always the case.