dart-lang / dart-pad

An online Dart editor with support for console, web, and Flutter apps
https://dartpad.dev
BSD 3-Clause "New" or "Revised" License
1.64k stars 546 forks source link

Cannot add spaces on mobile #2849

Open Xazin opened 3 months ago

Xazin commented 3 months ago

What happened?

I went on dartpad.dev to test something out while being on my phone. After deleting the existing for loop, I wanted to declare a variable, but I couldn't add spaces. Had to create new lines to declare a variable.

Steps to reproduce problem

Go on a physical mobile device and navigate to dartpad, try to use the software keyboard to add spaces.

Additional info

Browser

Browser: Chrome

Version: 120.0.6099.119 (?)

Model: iPhone 14 Plus

OS: iOS 17.2.1

Are you using any extensions/plugins that affect website behavior (particularly those that affect iframes, such as ad blockers)?

No

Are there any warnings or errors in your browser's JavaScript console? If so, paste them below:

No

osaxma commented 2 months ago

I did look into this briefly and tried to find the cause of the issue. The issue could be coming from codemirror itself but I am not sure.

I noticed that the new DartPad uses the following version:

https://github.com/dart-lang/dart-pad/blob/23b85fe9bb49ced21e8a69f8c7754ede53298e5f/pkgs/sketch_pad/web/codemirror/codemirror.js#L383

But it's worth noting that Codemirror5 recommends using version 6 since it has better support for mobile:

NOTE: CodeMirror 6 exists, and is more mobile-friendly, more accessible, better designed, and much more actively maintained.

I haven't gone further to test version 6 because I didn't know how the codemirror.js was produced.

DanTup commented 2 months ago

Maybe related? https://github.com/codemirror/codemirror5/issues/5367

It's milestone is "fixed in rewrite (hopefully)". There's a possible workaround (removing contenteditable) at https://github.com/codemirror/codemirror5/issues/5367#issuecomment-436151898 but I don't know if there are other implications of removing that.