znjameswu / flutter_math

Math rendering and editing in pure Flutter.
https://znjameswu.github.io/flutter_math_demo/
Apache License 2.0
123 stars 52 forks source link

SelectableMath's selection toolbar won't appear in mobile browsers in most cases #13

Open znjameswu opened 3 years ago

znjameswu commented 3 years ago

Currently SelectableMath employed a hack to get righ-click context menu on desktop web, as discussed in https://github.com/znjameswu/flutter_math/issues/10#issuecomment-714297030. However this has an unexpected side effect, because it breaks mobile browsers's selection toolbar.

On mobile web, the position of selection toolbar depends on the actual position of the underlying textarea (doesn't matter if Flutter Web clips it or not). If we make the textarea riduculously large, then the selection toolbar will fly outside the viewport in most cases.

znjameswu commented 3 years ago

I think it's better to drop the idea of using "native" context menu on web. MathQuill failed achieve it either. In fact, no web implementations did this with a native context menu. They all intercept the right click event and override with their custom context menu. Current Flutter can't do that easily.

Also, desktop web can still copy by ctrl+C in the future.

Once https://github.com/flutter/flutter/issues/31955 is resolved, native context menu on web will be dropped and replaced with a custom one. Currently they are still useful for web demos.