Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16369] Android: Disable copy,define,share popup contextual bar inside webview when selecting text

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-12-06T23:19:14.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsn/a
ReporterJignesh Kasundra
AssigneeFrankie Merzadyan
Created2014-01-31T10:03:46.000+0000
Updated2016-12-08T22:13:17.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
local_webview.html2016-09-14T09:28:25.000+00001927

Comments

  1. Ritu Agrawal 2014-02-04

    Contextual Action Bar use case: http://developer.android.com/design/patterns/actionbar.html
  2. Ritu Agrawal 2014-02-04

    Moving this feature request to engineering for further evaluation and prioritization. There is a pull request from the reporter for this feature but it is most likely on the wrong branch. https://github.com/appcelerator/titanium_mobile/pull/5309
  3. Tim Poulsen 2016-01-07

    Any word on this? The ticket is nearly two years old.
  4. Be Rushton 2016-04-26

    Might be time to start addressing some of these old tickets?
  5. Jignesh Kasundra 2016-05-17

    is there any time frame on this ticket ? as the ticket is raised two year back. the contextual action bar is very important for the application.
  6. Ashraf Abu 2016-05-18

    [~jignesh.igp] Just want to check, this is the removal of the ability to copy in the webview? Do you have a image that can be shared to show what you mean?
  7. Jignesh Kasundra 2016-05-19

    !http://testaz3.azardi.com/issue/copypaste.jpg!
  8. Ashraf Abu 2016-05-20

    Thanks for the photo.
  9. Ashraf Abu 2016-05-20

    [~bearus] [~timpoulsen] [~jignesh.igp] How exactly would you use this? For [~jignesh.igp], I assume you would just like the ability to stop this?
  10. Jignesh Kasundra 2016-05-20

    i need to stop that default contextual action bar which have options like copy , share etc. without blocking text selection. the contextual action bar (displayed on top in the image) get appeared on selecting text and i want to prevent that options ( copy , share etc)
  11. Tim Poulsen (ACV) 2016-05-24

    I'm afraid I commented four months ago and I don't recall exactly what my needs were at the time. I think it was to put a "share-to-specific app" shortcut in that action bar in place of the defaults.
  12. Ricardo Alcocer 2016-05-24

    The Android Contextual ActionBar (CAB) is much more than copy-paste from a WebView, or adding a Sharing Action Provider (which is exposed on my ActionBarExtras Module). Here's a native library to expose the CAB that shows an use-case different than the aforementioned.
  13. Ashraf Abu 2016-05-25

    So for now, the issue in this ticket would be [~jignesh.igp]'s issue on needing to stop/disable the CAB.
  14. Jignesh Kasundra 2016-05-25

    yes i need to stop/disable the CAB.
  15. Jignesh Kasundra 2016-06-02

    okay great. i am also facing same issue with iOS platform as well. after selecting a text in webview it shows me copy , define , share options so that also i need to stop/disable.
  16. Sharif AbuDarda 2016-07-03

  17. Jignesh Kasundra 2016-07-11

    Hello is that this ticket is under evaluation ?
  18. Hans Knöchel 2016-07-12

    So for iOS, I guess [~jignesh.igp] means the popup that is shown when you select text. That is a native behavior and should not be prevented from the native-side. Instead, the user can/should change the HTML attributes that disable text-selection. See [this thread](http://stackoverflow.com/a/6051172/5537752) on how to insert a CSS-snippet in your webview-source and it should work. Otherwise, please specify what exactly needs to be specified.
  19. Jignesh Kasundra 2016-07-27

    hello for iOS, the thread you suggested is also blocking the text selection. i need to disable only popup contextual menu which is appeared after selecting text. I know its iOS behavior but as i shared a screen shot of one of the iOS reading application where they hides the option like copy. (http://testaz3.azardi.com/issue/Reference.jpg) because the content we are rendering into webview is very valuable and need to prevent it from copy and share. for Android i think the engineering was done by Ashraf Abu and was planed to release the fix with the version 6.0.0
  20. Hans Knöchel 2016-09-14

    I introduced the new property disableSelection to disable the text-selection and hide the callout-bubble when being set to true (default is still false for backwards-compatibility) PR: https://github.com/appcelerator/titanium_mobile/pull/8378 Demo (local_webview.html is attached from the KitchenSink):
        var win = Ti.UI.createWindow();
        
        win.add(Ti.UI.createWebView({
            url: "examples/local_webview.html",
            disableSelection: true
        }));
        
        win.open();
        
  21. Chee Kiat Ng 2016-09-22

    CR and FT passed. you can use url: "http://google.com" instead. with disableSelection: true, you can try to press and hold any text, there will not be any pop up.
  22. Ashraf Abu 2016-09-22

    [~cng] I believe this requires Android parity.
  23. Chee Kiat Ng 2016-09-22

    [~fmerzadyan] can you take a look at implementing the android part?
  24. Farzad Merzadyan 2016-09-26

    Just to clarify, do you want to remove all options in contextual action bar: copy, share, select all, web search and assist? I put a placeholder text and icon just for demonstration of what I have right now. [link screenshot](http://s21.postimg.org/ueyct6kpz/cab_screenshot.png)
  25. Chee Kiat Ng 2016-09-28

    I think that's acceptable since it's a similar behavior in iOS.
  26. Christopher Williams 2016-10-06

    Ok, so I've tried to bring a little sanity to this ticket/request: - This ticket should cover being able to disable the default context bar actions when selecting text on Android. - TIMOB-23992 is the equivalent ticket for iOS - TIMOB-23993 is the feature request that [~timpoulsen] seemed to be asking for, which is to not necessarily to disable the context actions, but to substitute/add custom items there.
  27. Farzad Merzadyan 2016-10-11

  28. Christopher Williams 2016-10-28

    Merged PR to master. Can now use the disableContentMenu boolean property to disable the default context action bar from showing (cut/copy/paste/share) when selecting text in a WebView.
  29. Lokesh Choudhary 2016-12-01

    When disableContextMenu is set to false the context menu does not come up with SDK 6.1.0. Reopening. Appc Studio : 4.8.1.201611291132 SDK Version : 6.1.0.v20161201064221 Mac OS Version : 10.12 Xcode Version : Xcode 8.1 Build version 8B62 Appc CLI AND Appc NPM : {"NPM":"4.2.9-1","CLI":"6.1.0-302"} Ti CLI : 5.0.11 Alloy : 1.9.4 Node : v4.6.0 Device: running 7.1Pixel
  30. Farzad Merzadyan 2016-12-06

    master: https://github.com/appcelerator/titanium_mobile/pull/8660
  31. Samir Mohammed 2016-12-08

    Verified feature, when setting disableContextMenu to true the contextual bar is no longer present, setting disableContextMenu to false allows the contextual bar to be seen. *Environement*
        Appcelerator Command-Line Interface, version 6.0.0
        Android 7.0 (Google Nexus 6P)
        Iphone 6 plus (IOS version 9.3.4)
        Operating System Name: Mac OS X El Capitan
        Operating System Version: 10.11.6
        Node.js Version: 4.6.0
        npm: 4.2.8
        Titanium CLI Version: 5.0.10
        Titanium SDK Version: 6.1.0.v20161208114813
        Xcode: 8.0
        Appcelerator Studio: 4.8.0.201611121409
        

JSON Source