Closed Bug 1544438 Opened 5 years ago Closed 5 years ago

Backspace key deletes selected row even when editing a value

Categories

(DevTools :: Storage Inspector, defect, P3)

defect

Tracking

(firefox68 verified)

VERIFIED FIXED
Firefox 68
Tracking Status
firefox68 --- verified

People

(Reporter: fvsch, Assigned: fvsch)

References

Details

(Whiteboard: [qa-68b-p2])

Attachments

(1 file)

Probably an issue introduced in bug 1522893.
(As a side note, I'm not sure why Backspace removes the selected row but Suppr doesn't. A macOS keyboard bias maybe?)

Steps to reproduce:

  1. Visit https://www.wikipedia.org/
  2. Open the Storage Inspector and select Cookies > https://www.wikipedia.org
  3. Double-click a value to edit it.
  4. Hit the Backspace key.

Expected result: the text input's value should be cleared (if selected) or the character to the left of the caret should be removed.

Actual result: the currently selected row is removed.

Getting decent results with:

diff --git a/devtools/client/storage/ui.js b/devtools/client/storage/ui.js
--- a/devtools/client/storage/ui.js
+++ b/devtools/client/storage/ui.js
@@ -1137,10 +1137,13 @@ class StorageUI {
       this.sidebarToggledOpen = false;
       event.stopPropagation();
       event.preventDefault();
-    } else if (event.keyCode == KeyCodes.DOM_VK_BACK_SPACE && this.table.selectedRow) {
-      this.onRemoveItem();
-      event.stopPropagation();
-      event.preventDefault();
+    } else if (event.keyCode == KeyCodes.DOM_VK_BACK_SPACE ||
+      event.keyCode == KeyCodes.DOM_VK_DELETE) {
+      if (this.table.selectedRow && event.target.nodeName !== "textbox") {
+        this.onRemoveItem();
+        event.stopPropagation();
+        event.preventDefault();
+      }
     }
   }

Has STR: --- → yes
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All

Hey Florens, if you submit the patch I'll review and land it straight away.

Flags: needinfo?(florens)

I'm on something else right now but will try to push the patch soon.

David, can I pick your brain since you proposed deleting on Backspace originally? What do you think about also using the Delete key for the same action? On some keyboards (especially for Windows/Linux) I tend to use Delete more, and Backspace on macOS only for lack of a Delete key (I think you get Delete with Fn+Backspace?). Should we match both?

Flags: needinfo?(florens) → needinfo?(dwalsh)
Assignee: nobody → florens
Status: NEW → ASSIGNED

Yep, works for me!

Flags: needinfo?(dwalsh)
Pushed by florens@fvsch.com:
https://hg.mozilla.org/integration/autoland/rev/a7af13fee7b2
Prevent backspace from deleting Storage entry when editing; r=miker
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
QA Whiteboard: [qa-68b-p2]
Whiteboard: [qa-68b-p2]

Confirmed with 68.0a1(20190415213626).
Fix verified with 68.0.1, 69.0b11 on Windows 10, macOS 10.13, Ubuntu 16.04.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: