Closed Bug 1445942 Opened 7 years ago Closed 6 years ago

user pref 'permissions.default.shortcuts' screws up backspace and del keys

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P2)

59 Branch
x86_64
All
defect

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox-esr60 --- wontfix
firefox59 --- wontfix
firefox60 --- wontfix
firefox61 --- wontfix
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 --- fixed

People

(Reporter: daniel.schaaaf, Assigned: enndeakin)

References

Details

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180310025718

Steps to reproduce:

Change user_pref("permissions.default.shortcuts", 0); to user_pref("permissions.default.shortcuts", 2);

Issue was also reported here:
https://community.atlassian.com/t5/Confluence-questions/Unable-to-Copy-Using-CTRL-C-Hotkeys-on-Page-View-FF-59b6/qaq-p/719341


Actual results:

Backspace and del keys stopped working in text fields. Instead of deleting text characters, Firefox executed the assigned hotkey function (default go back for backspace).


Expected results:

Backspace and del keys should delete text characters in text fields (e.g. search input field on a webpage).
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Firefox: 59.0.1, Build ID: 20180315233128

I have managed to reproduce this issue on latest Firefox (59.0.1) release and latest Nightly (61.0a1) build on Windows 7 x64 and Mac 10.12.
It seems that the pref was introduce by bug 380637, but I am not sure what exactly does this pref.

@Neil can you please take a look at this issue?
Blocks: 380637
Status: UNCONFIRMED → NEW
Component: Untriaged → Event Handling
Ever confirmed: true
Flags: needinfo?(enndeakin)
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → x86_64
Is there a specific page where this issue is noticed?
Flags: needinfo?(enndeakin) → needinfo?(cosmin.muntean)
Yes, I have managed to reproduce the issue on google.com. Just type a text in the Google search bar and try to use the "Backspace" and "Delete" button. 
When using the "Backspace" button you are redirected to the previously page and it seems that the "Delete" button is not working only if the text is selected.

Please let me know if you need more information.
Flags: needinfo?(cosmin.muntean)
Setting "permissions.default.shortcuts" to a value of 2 disables shortcuts. Since any value =! 0 or 1 should do the trick, I tried 3. Interestingly, a value of 3 does not screw up backspace and delete.
Changing the site permission through 

Page Info > Permissions > Override Keyboard Shortcuts > Block 

causes the same issue (tested only on Windows 7):

* Delete does nothing when text is not selected (Shift+Delete works)
* Backspace goes Back, which normally only occurs when focus is outside of editable areas
Priority: -- → P2
All of that:
* `permissions.default.shortcuts = 2` breaking delete and backspace keys
* `permissions.default.shortcuts = 3` not breaking them
* blocking it for a page via `Page Info > Permissions > Override Keyboard Shortcuts > Block`
... is also reproductible on Windows 10 and openSUSE 64bit.
The simplest approach is to just make the backspace key not a reserved key.

A more complete approach might be to just treat all defined shortcuts that don't have modifiers specified not be reserved keys.
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Attachment #9029625 - Attachment is obsolete: true
Attachment #9030463 - Flags: review?(felipc)
Attachment #9030463 - Attachment is patch: true
Attachment #9030463 - Attachment mime type: application/octet-stream → text/plain
Attachment #9030463 - Flags: review?(felipc) → review+
Pushed by neil@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/648648a60190
make the backspace key a non-reserved key so that it isn't blocked by shortcut permissions, r=felipe
Backed out 2 changesets (bug 1513332, bug 1445942) for browser-chrome failures in browser/base/content/test/permissions/browser_reservedkey.js

Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=217538812&repo=mozilla-inbound&lineNumber=2569

13:28:34     INFO - Entering test bound test_reserved_shortcuts
13:28:34     INFO - Buffered messages logged at 13:27:06
13:28:34     INFO - Console message: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "data:text/html,<body onload='document.body.firstElementChild.focus();'><div onkeydown='event.preventDefault();' tabindex=0>Test</div></body>" line: 0}]
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | reserved='true' with preference off - 
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | reserved='false' with preference off - 
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | default reserved with preference off - 
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | reserved='true' with preference on - 
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | reserved='false' with preference on - 
13:28:34     INFO - TEST-PASS | browser/base/content/test/permissions/browser_reservedkey.js | default reserved with preference on - 
13:28:34     INFO - Leaving test bound test_reserved_shortcuts
13:28:34     INFO - Entering test bound test_backspace
13:28:34     INFO - Buffered messages logged at 13:27:07
13:28:34     INFO - Console message: [JavaScript Error: "SyntaxError: expected expression, got '}'" {file: "data:text/html,<body onbeforeunload='document.getElementById('field').value = 'failed'; event.preventDefault();'><input id='field' value='something' autofocus></body>" line: 2 column: 0 source: "}"}]
13:28:34     INFO - Console message: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "data:text/html,<body onbeforeunload='document.getElementById('field').value = 'failed'; event.preventDefault();'><input id='field' value='something' autofocus></body>" line: 0}]
13:28:34     INFO - Buffered messages finished
13:28:34     INFO - TEST-UNEXPECTED-FAIL | browser/base/content/test/permissions/browser_reservedkey.js | backspace not prevented - Got something, expected omething
13:28:34     INFO - Stack trace:
13:28:34     INFO - chrome://mochikit/content/browser-test.js:test_is:1312
13:28:34     INFO - chrome://mochitests/content/browser/browser/base/content/test/permissions/browser_reservedkey.js:test_backspace:141
13:28:34     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest/<:1102
13:28:34     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1093
13:28:34     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:991
13:28:34     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<:803
13:28:34     INFO - Leaving test bound test_backspace
13:28:34     INFO - GECKO(851) | [Child 853, Main Thread] WARNING: SendNotifyIMEFocus got rejected.: file /builds/worker/workspace/build/src/widget/PuppetWidget.cpp, line 779
13:28:34     INFO - GECKO(851) | MEMORY STAT | vsize 4423MB | residentFast 333MB | heapAllocated 105MB
13:28:34     INFO - TEST-OK | browser/base/content/test/permissions/browser_reservedkey.js | took 1347ms
13:28:34     INFO - GECKO(851) | ++DOCSHELL 0x124dc9000 == 3 [pid = 853] [id = {939edc05-d69f-9d4f-bc8c-6806a1b2ad45}]
13:28:34     INFO - GECKO(851) | ++DOMWINDOW == 9 (0x125e05800) [pid = 853] [serial = 17] [outer = 0x0]
13:28:34     INFO - GECKO(851) | ++DOMWINDOW == 10 (0x125e09c00) [pid = 853] [serial = 18] [outer = 0x125e05800]
13:28:34     INFO - GECKO(851) | [Child 853, Main Thread] WARNING: 'NS_FAILED(rv)', file /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp, line 8205
13:28:34     INFO - GECKO(851) | ++DOMWINDOW == 11 (0x125e10c00) [pid = 853] [serial = 19] [outer = 0x125e05800]
13:28:34     INFO - GECKO(851) | [Child 853, Main Thread] WARNING: 'NS_FAILED(rv)', file /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp, line 8205
13:28:34     INFO - checking window state

Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&group_state=expanded&revision=648648a60190278663379270879e053c9d767f70

Backout:
https://hg.mozilla.org/integration/mozilla-inbound/rev/303797fd37227647995d902c220177df611c58e3
Flags: needinfo?(enndeakin)
Flags: needinfo?(enndeakin)
Attachment #9030463 - Attachment is obsolete: true
Attachment #9033564 - Flags: review?(felipc)
Attachment #9033564 - Flags: review?(felipc) → review+
Pushed by neil@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/72da18aff712
make the backspace key a non-reserved key so that it isn't blocked by shortcut permissions, r=felipe
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66

I can confirm that the patch pushed by Neil Deakin at https://hg.mozilla.org/mozilla-central/rev/72da18aff712 ("make the backspace key a non-reserved key...") is working for the backspace key in 66.0b7

However, the problem with the delete key remains: it deletes text when selected, however it does not have any effect when no text is selected (but text exists to the right of the cursor).

So this is only partly resolved.

That should be just adding the same annotation for the delete key, a couple of lines earlier.

Component: Event Handling → User events and focus handling

I'm a little bit confused: should the delete key still be blocked from working, or has that been fixed? In my Firefox 66.0.2 (64-bit) Win 10, the backspace key now works properly, but delete still does nothing to text (except on selected text, as before); I've observed this on a site with "override keyboard shortcuts" blocked locally (global allow). Should I open a new bug for the delete key?

(In reply to Neil Deakin from comment #15)

That should be just adding the same annotation for the delete key, a couple of lines earlier.

This sounds reasonable to me. After having upgraded to FF 68 today either the annotation is still missing or there is another issue with the "Del"-key. In my installation, it is still not working.

See Also: → 1604970
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: