mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1597707 - Do not dispatch SELECT_ALL selection action if the input is empty or all the text is already selected. r=esawin
Do not dispatch SELECT_ALL selection action if the input is empty or all the text is already selected. Differential Revision: https://phabricator.services.mozilla.com/D53828 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
af9edac0e5
commit
397c73b3bb
@ -70,7 +70,18 @@ class GeckoViewSelectionActionChild extends GeckoViewChildModule {
|
||||
},
|
||||
{
|
||||
id: "org.mozilla.geckoview.SELECT_ALL",
|
||||
predicate: e => e.reason !== "longpressonemptycontent",
|
||||
predicate: e => {
|
||||
if (e.reason === "longpressonemptycontent") {
|
||||
return false;
|
||||
}
|
||||
if (e.target && e.target.activeElement) {
|
||||
const value = e.target.activeElement.value;
|
||||
// Do not show SELECT_ALL if the input is empty
|
||||
// or all the input text is already selected.
|
||||
return value !== "" && value !== e.selectedTextContent;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
perform: e => docShell.doCommand("cmd_selectAll"),
|
||||
},
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user