Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23992] iOS: Disable context menu inside webview when selecting text

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-11-28T09:01:35.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsn/a
ReporterJignesh Kasundra
AssigneeHans Knöchel
Created2016-10-06T15:02:34.000+0000
Updated2017-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

FileDateSize
screenshot-1.png2017-01-05T17:08:57.000+00009448

Comments

  1. Hans Knöchel 2016-10-07

    PR: https://github.com/appcelerator/titanium_mobile/pull/8488
  2. Hans Knöchel 2016-10-07

    I added the two methods. However, we have a problem here: - If the user set disableTextSelection to true and disableContextMenu to false, the context menu is not shown because it depends on the text selection - If the user set disableTextSelection to false and disableContextMenu to true, 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 make disableContextMenu Android-only and handle both in {{disableTextSelection). I would prefer the first proposal. Thx!
  3. Hans Knöchel 2016-11-18

    PR to fix the selection for device-builds as well: https://github.com/appcelerator/titanium_mobile/pull/8629
  4. Harry Bryant 2017-01-05

    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 of disableTextSelection 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

JSON Source