Bug 1240917 - Tweak ActionBar behavior when selection is collapsed. r=snorp
* Long pressing on empty input -> show the ActionBar.
* Single tapping on input (either empty or non-empty) -> do not show the
ActionBar.
--- a/mobile/android/chrome/content/ActionBarHandler.js
+++ b/mobile/android/chrome/content/ActionBarHandler.js
@@ -30,16 +30,37 @@ var ActionBarHandler = {
*/
caretStateChangedHandler: function(e) {
// Close an open ActionBar, if carets no longer logically visible.
if (this._selectionID && !e.caretVisible) {
this._uninit(false);
return;
}
+ if (!this._selectionID && e.collapsed) {
+ switch (e.reason) {
+ case 'longpressonemptycontent':
+ // case 'taponcaret':
+ // Show ActionBar when long pressing on an empty input.
+ // XXX: If we ever want to show ActionBar when single tapping on the
+ // caret, uncomment the above case 'taponcaret'.
+ this._init();
+ break;
+
+ case 'updateposition':
+ // Do not show ActionBar when single tapping on an non-empty editable
+ // input.
+ break;
+
+ default:
+ break;
+ }
+ return;
+ }
+
// Open a closed ActionBar if carets actually visible.
if (!this._selectionID && e.caretVisuallyVisible) {
this._init();
return;
}
// Else, update an open ActionBar.
if (this._selectionID) {