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

Copy/Cut broken on safari on iPadOS #109635

Closed
kieferrm opened this issue Oct 29, 2020 · 4 comments
Closed

Copy/Cut broken on safari on iPadOS #109635

kieferrm opened this issue Oct 29, 2020 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ios-ipados verified Verification succeeded web Issues related to running VSCode in the web
Milestone

Comments

@kieferrm
Copy link
Member

kieferrm commented Oct 29, 2020

Testing #109422.

Cmd+C and Cmd+X are broken on safari on iPadOS in the Monaco editor and the terminal. It seems to me that this is related to the detection of the selection. When having a selection, the iPad toolbar does not show the copy action not do the key bindings work.

However, sometimes I can make it show up: Copy text from the omnibar, then paste into the editor using the key bindings or the iPad toolbar. In most cases the selection you make right after causes the copy action to be enabled.

@kieferrm kieferrm added ios-ipados web Issues related to running VSCode in the web labels Oct 29, 2020
@rebornix
Copy link
Member

@kieferrm my guess is you are selecting text through trackpad, right? I didn't reproduce this with selection through arrow keys, but if I use trackpad to select text, even though we do see the selection, it's actually an iOS native selection other than our virtual selection, then the Copy/Cut doesn't work as the editor is not even selected. It's a more severe problem with how selections are being handled now.

I'm not seeing this issue with https://microsoft.github.io/monaco-editor/ so might not be a regression from our side recently. Will dig into a bit more why that happens.

@rebornix
Copy link
Member

However, sometimes I can make it show up

With a second try I can't reproduce the issue anymore and reloading the window and tried the third time and ran into it again. When this happens, clicking into the editor doesn't put focus into the editor text.

ezgif-6-239d332a8ec3

update

my 100% reproduce steps are

  • use finger to change cursor position in the editor, should see the blinking cursor
  • then use trackpad to select text, no blinking cursor anymore

@rebornix
Copy link
Member

rebornix commented Oct 30, 2020

Previously with iOS/iPadOS 13, pointer events work well with mouse events as at that moment, trackpad or external mouse were treated the same as pointer device (Apple Pencil). Now with iOS/iPadOS 14, trackpad and mouse are now treated as real mouse.

Our current logic on iOS:

  • listen to pointerdown and pointermove events for trackpad, mouse and pencil, to mimic clicking and selecting
  • listen to touchStart/End for finger actions, to mimic clicking and scrolling

However there is potentially an iOS 14 bug with pointermove event that as long as you use finger to tab on the editor, trackpad will only emit mousemove events (no more pointermove events). Verified that tabing into Monaco editor also breaks the pointermove listener on the terminal (xterm DOM, which is sibling or the Monaco editor). Though I'm not able to reproduce this issue with a simple DIV element.

Considering that webkit doesn't fully support pointer events as advertised and how trackpad/mouse are handled now in latest iOS, we should do following refactoring to archive an identical desktop like experience

  • listen to mouse events like what we do on desktop, it will handle trackpad/mouse clicking and text selection.
  • listen to touchStart/End as before for fingers.
  • listen to pointer events and filter out pointerType === 'mouse', this code path is specifically for Apple Pencil. Need to think about what's the right behavior for the pencil as now you can write text directly with the pencil.

@rebornix rebornix added this to the November 2020 milestone Oct 30, 2020
@rebornix rebornix added the bug Issue identified by VS Code Team member as probable bug label Nov 3, 2020
@rebornix rebornix modified the milestones: January 2021, Backlog Jan 28, 2021
@isidorn isidorn self-assigned this May 7, 2021
@isidorn isidorn modified the milestones: Backlog, May 2021 May 7, 2021
@isidorn
Copy link
Contributor

isidorn commented May 21, 2021

With the fix for #122653 this now works great for me.
I can select using touch, mouse, keyboard and copy/cut always work for me.

@kieferrm if you can try it out and let me know if you find some scenario where this is still not working. Thanks a lot!

@isidorn isidorn closed this as completed May 21, 2021
@weinand weinand added the verified Verification succeeded label Jun 7, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug ios-ipados verified Verification succeeded web Issues related to running VSCode in the web
Projects
None yet
Development

No branches or pull requests

4 participants