[TIMOB-25705] TiAPI: Add "enableCopy" property to TextField/TextArea
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-06-07T19:00:41.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.0.1 |
Components | Android, iOS |
Labels | 2021-Q2, TextArea, TextField, android, copy, cut, ios, security |
Reporter | Rene Pot |
Assignee | Joshua Quick |
Created | 2018-01-24T22:26:50.000+0000 |
Updated | 2021-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
File | Date | Size |
---|---|---|
TextAreaDisableCopyTest.js | 2021-03-25T03:11:32.000+0000 | 843 |
TextFieldDisableCopyTest.js | 2021-03-25T03:00:45.000+0000 | 1366 |
TextFieldKeyboardAdvancedTest.js | 2021-03-25T03:27:04.000+0000 | 9014 |
Hello, Thanks for the ticket. Our engineers will look into it. You will be notified when they decide to implement this. Thanks.
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.PR (master): https://github.com/appcelerator/titanium_mobile/pull/12657
merged PR to master, manually cherry-picked to 10_0_X branch for 10.0.1 target