[TIMOB-23992] iOS: Disable context menu inside webview when selecting text
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-11-28T09:01:35.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | Release 6.1.0 |
Components | iOS |
Labels | n/a |
Reporter | Jignesh Kasundra |
Assignee | Hans Knöchel |
Created | 2016-10-06T15:02:34.000+0000 |
Updated | 2017-03-08T15:53:05.000+0000 |
Description
Hi...
In webView when selecting the content or text a default popup menu gets appeared with the options copy, define, share etc.
Is it possible to remove this option without blocking webview text selection? Also, add some new menu option?
---
We should add a boolean property to disable the default set of context actions in the action bar. We may *also* want to allow disable text selection altogether.
var webView = Ti.UI.createWebView({
disableTextSelection: false,
disableContextMenu: true
});
Attachments
File | Date | Size |
---|---|---|
screenshot-1.png | 2017-01-05T17:08:57.000+0000 | 9448 |
PR: https://github.com/appcelerator/titanium_mobile/pull/8488
I added the two methods. However, we have a problem here: - If the user set
disableTextSelection
totrue
anddisableContextMenu
tofalse
, the context menu is not shown because it depends on the text selection - If the user setdisableTextSelection
tofalse
anddisableContextMenu
totrue
, both the context menu and the text selection is shown And that looks like an internal iOS behavior, because selecting an action without selecting a text does not make sense and selecting a text without presenting actions does not make sense as well. [~cwilliams] please advice what you thing is the best solution here. We either leave a note in the docs regarding this behavior (already done for the first use-case) or makedisableContextMenu
Android-only and handle both in {{disableTextSelection). I would prefer the first proposal. Thx!PR to fix the selection for device-builds as well: https://github.com/appcelerator/titanium_mobile/pull/8629
Tested various true/false combinations of the
disableContextMenu
&disableTextSelection
properties for both iOS device and Simulators: !screenshot-1.png! The results show that the contextMenu can now be correctly disabled on device builds, however it was found that in any case where the contextMenu is accessible, text selection is also accessible, regardless ofdisableTextSelection
being set to true. From what I've observed, it seems that the property has no actual effect. [~hansknoechel] can you shed some light on whether this is the intended behavior? Tested On: iPhone 7 10.2 Device & Simulator Mac OS Sierra (10.12.2) Ti SDK:6.1.0.v20170101113815 Appc Studio: 4.8.0.201611121409 Appc NPM: 4.2.8 App CLI: 6.1.0-319 Xcode 8.2.1 Node v4.4.7