Open
Bug 1327982
Opened 8 years ago
Updated 2 years ago
Ctrl+F in inspector doesn't work if I use russian keyboard layout
Categories
(DevTools :: Shared Components, defect, P2)
DevTools
Shared Components
Tracking
(Not tracked)
NEW
People
(Reporter: arni2033, Unassigned)
References
Details
(Keywords: regression)
>>> My Info: Win7_64, Nightly 49, 32bit, ID 20160526082509
STR_1:
0. Switch keyboard layout to russian
1. Open inspector on this page, click on <body> element in markup
2. Press Ctrl+F
AR: Findbar opens
ER: Search field "Search HTML" should be focused in inspector
Marked as blocking for bug 1263336 for now, because this mistake can be made in each tool.
This is regression from bug 1268441. Regression range:
> https://hg.mozilla.org/integration/fx-team/pushloghtml?fromchange=6e3f70253eadc6db358f68e7626aa27d76137dbc&tochange=092d7ffc5eeed5c0096117fff18638bbda0ebf6e
Component: Developer Tools: Animation Inspector → Developer Tools: Inspector
Comment 1•8 years ago
|
||
I can reproduce this on Windows only, by changing the keyboard layout to Russian. I'm not sure how many locales and shortcuts are affected.
With a russian layout the F key is merged with the cyrillic character `a` key. The keyboard event retrieved in this case has the following properties:
- key : a (the cyrillic one)
- keyCode : 70
key-shortcuts.js prefers the event.key to event.keyCode:
> let key = event.key || String.fromCharCode(event.keyCode);
(http://searchfox.org/mozilla-central/source/devtools/client/shared/key-shortcuts.js#213)
So here we are getting the wrong key, but String.fromCharCode would return the appropriate result.
Alex: this seems worth fixing? Could we always use String.fromCharCode(event.keyCode)?
Component: Developer Tools: Inspector → Developer Tools: Shared Components
Flags: needinfo?(poirot.alex)
Priority: -- → P2
Comment 2•8 years ago
|
||
Another option is to ask localizers to use different keys when localizing devtools shortcut, but I checked how the search shortcut was translated when it was in XUL/dtd and it was already mapped to CTRL F for russian.
https://hg.mozilla.org/l10n-central/ru/file/4dd7a46f54f1/devtools/client/inspector.dtd
Comment 3•8 years ago
|
||
I would prefer to not change the behavior.
This is definitely worth fixing!
We can't use just String.fromCharCode(event.keyCode).
Here is an example that wouldn't work anymore:
On a french keyboard, press the key "&" (It is on the key for digit 1, but 1 requires shift to be pressed).
When pressing just "&" (without shift), keyCode = 49, String.fromCharCode(49) = 1.
Only event.key allows to know that we pressed "&" as final character.
But look at existing code:
let key = event.key || String.fromCharCode(event.keyCode);
// For character keys, we match if the final character is the expected one.
// But for digits we also accept indirect match to please azerty keyboard,
// which requires Shift to be pressed to get digits.
return key.toLowerCase() == shortcut.key ||
(shortcut.key.match(/[0-9]/) &&
event.keyCode == shortcut.key.charCodeAt(0));
I think your proposal to use String.fromCharCode is equivalent to keyCode == shortcut.key.charCodeAt(0),
so we may want to generalize and not restrict that to digits...
Flags: needinfo?(poirot.alex)
Updated•7 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•