Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25705] TiAPI: Add "enableCopy" property to TextField/TextArea

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2021-06-07T19:00:41.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.1
ComponentsAndroid, iOS
Labels2021-Q2, TextArea, TextField, android, copy, cut, ios, security
ReporterRene Pot
AssigneeJoshua Quick
Created2018-01-24T22:26:50.000+0000
Updated2021-06-07T19:00:41.000+0000

Description

*Summary:* We should add a property to prevent the end-user from copying text from a Ti.Ui.TextField and Ti.UI.TextArea. The intention is to improve security and block accidental copying of personal information to the clipboard which can be accessed by external apps. *Proposal:* Add boolean property "enableCopy", which will default to true. The following must happen when setting this to false... * Context menu will not show: copy, cut, share * Command+C and Command+X shortcuts will be ignored. *Note:* On Android, we can't remove the "copy" and "cut" options from: - Virtual keyboard's "Text Editing" section. - Landscape fullscreen edit mode's context menu. That said, we can make the "copy" and "cut" options no-op in the above cases and block the copy.

Attachments

FileDateSize
TextAreaDisableCopyTest.js2021-03-25T03:11:32.000+0000843
TextFieldDisableCopyTest.js2021-03-25T03:00:45.000+00001366
TextFieldKeyboardAdvancedTest.js2021-03-25T03:27:04.000+00009014

Comments

  1. Sharif AbuDarda 2018-01-25

    Hello, Thanks for the ticket. Our engineers will look into it. You will be notified when they decide to implement this. Thanks.
  2. Joshua Quick 2021-03-23

    After playing around with our native options, I've determined that there is no reliable way of completely removing Android's context menu. While we can get rid of the context menu that appears when tapping on the text or long pressing the text field, it can still be displayed via other means... * By tapping on the editor's caret. * Tapping at the end of the field on a real device. * Virtual keyboard has its own copy/paste section that we have no control over. So, an alternative solution would be to provide a new "enableCopy" property, when set false, we can prevent the copy action. We'll attempt to remove the "Copy" menu item where we can of course so it's less confusing to the end-user (and preserve the rest of the menu items). I think this is the only good solution since we can't control the options shown to the end-user in all places, such as the Android virtual keyboard Note that I've confirmed that we can easily remove the "Copy" option from iOS.
  3. Joshua Quick 2021-03-25

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12657
  4. Christopher Williams 2021-06-07

    merged PR to master, manually cherry-picked to 10_0_X branch for 10.0.1 target

JSON Source