Reader Mode activates erroneously when trying to activate the Search History in the Console's multi-line editor mode
Categories
(DevTools :: Console, defect)
Tracking
(firefox86 fixed)
| Tracking | Status | |
|---|---|---|
| firefox86 | --- | fixed |
People
(Reporter: itiel_yn8, Assigned: nchevobbe)
Details
Attachments
(1 file)
STR:
- Be on this bugzilla ticket
- Ctrl+Shift+K to open the console
- Enable the multi-line editor mode
- Hit F9 to enter the Search History function there
AR:
The webpage enters reader mode, and the Search History activates, both at the same time.
ER:
Assumingly don't enter reader mode, but I'm not sure what would be the criteria for not enabling it...
Comment 1•4 years ago
|
||
So, funny thing, I don't get offered reader mode on this bug at time of writing (I expect it depends on the amount of text, so this might change with this comment and/or later). Also, on macOS the shortcut for history appears to be Ctrl+R, and the reader mode shortcut is command+opt+R on macOS, so there's no conflict. But I can see how this would be an issue on Windows/Linux, where the shortcuts are presumably the same...
I think devtools already calls preventDefault() at https://searchfox.org/mozilla-central/rev/8d722de75886d6bffc116772a1db8854e34ee6a7/devtools/client/webconsole/components/Input/ReverseSearchInput.js#116-118 . This is done from the keydown handler. AFAICT the reader mode shortcut (implemented using a <key> element) gets invoked before devtools even runs.
Neil, do you know why, in this case, XUL's <key> element handling happens before devtools, even if focus is in the input box there? Is there anything we can do to fix this?
Comment 2•4 years ago
|
||
Hey Mossop, I know you did some <key> stuff back in the day for de-XBL'ing... is this something that sounds kinda familiar? In particular, why does the <key> event on a window handle the key events before DevTools, even if input focus is on the devtools and they preventDefault on it? (The <key> looks like it tries to handle the event at the bubbling phase).
Updated•4 years ago
|
Comment 3•4 years ago
|
||
(To be clear, I can reproduce this on Windows.)
Comment 4•4 years ago
|
||
The problem is that devtools aren't calling preventDefault on the event. The handler that Gijs points to is the one on the Search History input itself and that does preventDefault and indeed reader mode doesn't open if you press F9 while that is focused. The handler for the console editor panel though is this one: https://searchfox.org/mozilla-central/source/devtools/client/webconsole/components/App.js#137-148
Updated•4 years ago
|
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Good eye, thanks Mossop!
Updated•4 years ago
|
| Assignee | ||
Comment 6•4 years ago
|
||
Thanks Gijs and Dave for the investigation, I'll fix that
| Assignee | ||
Comment 7•4 years ago
|
||
We weren't calling preventDefault on the event handler, which was
allowing the browser to consume it, and toggle reader mode on windows,
which shares the same keyboard shortcut (F9).
A test is added to ensure we don't regress this (the test is failing without
the fix).
Comment 9•4 years ago
|
||
Backed out changeset 65d5af50131e (bug 1682340) for causing dt failures in browser_jsterm_editor_reverse_search_keyboard_navigation.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/7c19b76d5d7d0e1bd5d1311f5c3e5d8a999472d5
Failure log: https://treeherder.mozilla.org/logviewer?job_id=327062358&repo=autoland&lineNumber=40423
Comment 10•4 years ago
|
||
Comment 11•4 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•4 years ago
|
Description
•