Repository: vscode
Issue: CodeLens widgets aren't tappable on mobile devices
Labels: bug,code-lens,safari

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.73.1
- OS Version: N/A

Steps to Reproduce:

1. Use a touchscreen enabled device (like an Android phone or an iPhone).
2. Open https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-codelens-provider-example
3. Attempt to tap on the "First Line" Codelens button.
4. Notice that nothing happens.
5. Do the same thing with a mouse (possibly on a different device).
6. Notice that an alert pops up.

I'm developing a website that has fairly deep integration with the [monaco-editor](https://github.com/microsoft/monaco-editor), and we ran across an issue where CodeLens actions are not tappable when using an iPad or other touch device (the issue happens on both iOS Safari and Android Chrome/Edge. It even occurs when using [Chrome's built-in mobile device viewport simulation](https://developer.chrome.com/docs/devtools/device-mode/#viewport)).

After investigation, it appears that the browser is prevented from emulating click events by [`touch.ts`](https://github.com/microsoft/vscode/blob/a9f0251619990b5794723ba1a29bc33660a07a88/src/vs/base/browser/touch.ts#L68), and as a result, the various event handlers need to know how to understand both `click` and `-monaco-gesturetap` events to properly support touch devices. For widgets in particular, I noticed that the [`MouseHandler`](https://github.com/microsoft/vscode/blob/a9f0251619990b5794723ba1a29bc33660a07a88/src/vs/editor/browser/controller/mouseHandler.ts#L54) class handles `mousedown` and `mouseup` events differently than how the [`pointerHandler.ts`](https://github.com/microsoft/vscode/blob/a9f0251619990b5794723ba1a29bc33660a07a88/src/vs/editor/browser/controller/pointerHandler.ts#L22) classes handle the `-monaco-gesturetap` event.

My reasoning is that VSCode should be able to gain support for tapping widgets fairly easily by making the `PointerEventHandler` and `TouchHandler` emit the `mousedown` and `mouseup` equivalents when a touch affects a widget, similarly to how a browser would issue a `click` event. Does that sound like a reasonable solution to this problem?

I was planning on making a PR to fix this, and was wondering what other people's thoughts are on it. If you want to see what the changes mentioned above look like, check out [this diff](https://github.com/microsoft/vscode/compare/main...casual-simulation:vscode:fix/tappable-widgets).