Closed Bug 1005822 Opened 12 years ago Closed 12 years ago

ResponsiveUI: Add config option to disable closing on "esc"

Categories

(Firefox :: Untriaged, defect)

29 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bugzilla, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0 (Beta/Release) Build ID: 20140421221237 Steps to reproduce: DevTools, Responsive Design View. I have a mobile site, where I have to test the behaviour of the "Esc" key. This provides a problem, because the esc key also closes the ResponsiveUI. Expected results: The event handler `onKeypress` is here: http://dxr.mozilla.org/mozilla-central/source/browser/devtools/responsivedesign/responsivedesign.jsm#316 Would it be possible to add a settings query for, e.g., devtools.responsiveUI.closeOnEsc so when the setting is wrong, the esc key will not close the ResponsiveUI? Something along: @@ -316,9 +316,10 @@ onKeypress: function RUI_onKeypress(aEvent) { if (aEvent.keyCode == this.mainWindow.KeyEvent.DOM_VK_ESCAPE && + Services.prefs.getBoolPref("devtools.responsiveUI.closeOnEsc", true) && this.mainWindow.gBrowser.selectedBrowser == this.browser) { aEvent.preventDefault(); aEvent.stopPropagation(); this.close(); } },
This is a think that can be done in the page (cancelling the event).
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Yes, the following snippet does that: document.addEventListener('keypress', function(evt) { if (evt.keyCode === 27) { evt.stopPropagation(); } }); It might however have unwanted side effects when throwing it in a bunch of legacy code. Especially when the need to test the functionality of catching the escape key is buried in 3rd party code. I'd still rather disable the escape key for the ResponsiveUI than changing the code under development and producing unwanted side effects.
You need to log in before you can comment on or make changes to this bug.