Bug 522039: The prompt-service should dismiss the alert/prompt/confirm/... on VK_RETURN / VK_ESCAPE [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 13 Oct 2009 16:56:31 -0400
changeset 65659 b9d38a58c47ce52751cf444acbc0df1fa5ea7ac1
parent 65658 7103810a9883d03a161be26b024abf58e4db8488
child 65660 9e18912130386b5cfc47451ede6f4c171982d838
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark
bugs522039
Bug 522039: The prompt-service should dismiss the alert/prompt/confirm/... on VK_RETURN / VK_ESCAPE [r=mark.finkle]
mobile/chrome/content/prompt/alert.xul
mobile/chrome/content/prompt/confirm.xul
mobile/chrome/content/prompt/prompt.xul
mobile/chrome/content/prompt/promptPassword.xul
mobile/chrome/content/prompt/select.xul
--- a/mobile/chrome/content/prompt/alert.xul
+++ b/mobile/chrome/content/prompt/alert.xul
@@ -1,20 +1,27 @@
 <?xml version="1.0"?>
 <!DOCTYPE fdialog SYSTEM "chrome://browser/locale/prompt.dtd">
 <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       id="prompt-alert-dialog"
+      onload="document.getElementById('prompt-button-ok').focus()"
       onclose="this.PromptHelper.onCloseAlert(this);"
       script="chrome://browser/content/prompt/prompt.js">
-  
+  <keyset>
+    <key keycode="VK_RETURN" command="cmd_ok"/>
+    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
+  </keyset>
+  <commandset>
+    <command id="cmd_ok" oncommand="document.getElementById('prompt-alert-dialog').close()"/>
+    <command id="cmd_cancel" oncommand="document.getElementById('prompt-alert-dialog').close()"/>
+  </commandset>
   <label id="prompt-alert-title" crop="center"/>
   <scrollbox orient="vertical" class="prompt-message">
     <description id="prompt-alert-message"/>
   </scrollbox>
   <hbox id="prompt-alert-checkbox-box" collapsed="true" align="center" class="prompt-message">
     <description id="prompt-alert-checkbox-msg"/>
     <checkbox class="toggle-dark" id="prompt-alert-checkbox"/>
   </hbox>
   <hbox pack="center" class="prompt-buttons">
-    <button class="button-dark" label="&ok.label;"
-            oncommand="document.getElementById('prompt-alert-dialog').close()"/>
+    <button id="prompt-button-ok" class="button-dark" label="&ok.label;" command="cmd_ok"/>
   </hbox>
 </dialog>
--- a/mobile/chrome/content/prompt/confirm.xul
+++ b/mobile/chrome/content/prompt/confirm.xul
@@ -1,21 +1,28 @@
 <?xml version="1.0"?>
 <!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
 <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       id="prompt-confirm-dialog"
+      onload="document.getElementById('prompt-confirm-button-ok').focus()"
       onclose="this.PromptHelper.onCloseConfirm(this)"
       script="chrome://browser/content/prompt/prompt.js">
+  <keyset>
+    <key keycode="VK_RETURN" command="cmd_ok"/>
+    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
+  </keyset>
+  <commandset>
+    <command id="cmd_ok" oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(true)"/>
+    <command id="cmd_cancel" oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(false)"/>
+  </commandset>
   <label id="prompt-confirm-title"/>
   <scrollbox orient="vertical" class="prompt-message">
     <description id="prompt-confirm-message"/>
   </scrollbox>
   <hbox id="prompt-confirm-checkbox-box" collapsed="true" align="center" class="prompt-message">
     <description id="prompt-confirm-checkbox-msg"/>
     <checkbox class="toggle-dark" id="prompt-confirm-checkbox"/>
   </hbox>
   <hbox pack="center" id="prompt-confirm-button-box" class="prompt-buttons">
-    <button class="button-dark" label="&ok.label;"
-            oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(true);"/>
-    <button class="button-dark" label="&cancel.label;"
-            oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(false);"/>
+    <button id="prompt-confirm-button-ok" class="button-dark" label="&ok.label;" command="cmd_ok"/>
+    <button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
   </hbox>
 </dialog>
--- a/mobile/chrome/content/prompt/prompt.xul
+++ b/mobile/chrome/content/prompt/prompt.xul
@@ -1,23 +1,29 @@
 <?xml version="1.0"?>
 <!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
 <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       id="prompt-prompt-dialog"
+      onload="document.getElementById('prompt-prompt-textbox').focus()"
       onclose="this.PromptHelper.onClosePrompt(this)"
-      onload="document.getElementById('prompt-prompt-textbox').focus()"
       script="chrome://browser/content/prompt/prompt.js">
+  <keyset>
+    <key keycode="VK_RETURN" command="cmd_ok"/>
+    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
+  </keyset>
+  <commandset>
+    <command id="cmd_ok" oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(true)"/>
+    <command id="cmd_cancel" oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(false)"/>
+  </commandset>
   <label id="prompt-prompt-title"/>
   <scrollbox orient="vertical" class="prompt-message">
     <description id="prompt-prompt-message"/>
   </scrollbox>
   <textbox id="prompt-prompt-textbox"/>
   <hbox id="prompt-prompt-checkbox-box" collapsed="true" align="center" class="prompt-message">
     <description id="prompt-prompt-checkbox-msg"/>
     <checkbox class="toggle-dark" id="prompt-prompt-checkbox"/>
   </hbox>
   <hbox pack="center" id="prompt-prompt-button-box" class="prompt-buttons">
-    <button class="button-dark" label="&ok.label;"
-            oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(true)"/>
-    <button class="button-dark" label="&cancel.label;"
-            oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(false)"/>
+    <button class="button-dark" label="&ok.label;" command="cmd_ok"/>
+    <button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
   </hbox>
 </dialog>
--- a/mobile/chrome/content/prompt/promptPassword.xul
+++ b/mobile/chrome/content/prompt/promptPassword.xul
@@ -2,19 +2,27 @@
 <!DOCTYPE dialog [
 <!ENTITY % promptDTD SYSTEM "chrome://browser/locale/prompt.dtd">
 <!ENTITY % commonDialogDTD SYSTEM "chrome://global/locale/commonDialog.dtd">
  %promptDTD;
  %commonDialogDTD;
 ]>
 <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       id="prompt-password-dialog"
+      onload="document.getElementById('prompt-password-user').focus()"
       onclose="this.PromptHelper.onClosePassword(this)"
-      onload="document.getElementById('prompt-password-user').focus()"
       script="chrome://browser/content/prompt/prompt.js">
+  <keyset>
+    <key keycode="VK_RETURN" command="cmd_ok"/>
+    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
+  </keyset>
+  <commandset>
+    <command id="cmd_ok" oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(true)"/>
+    <command id="cmd_cancel" oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(false)"/>
+  </commandset>
   <label id="prompt-password-title"/>
   <scrollbox orient="vertical" class="prompt-message">
     <description id="prompt-password-message"/>
   </scrollbox>
   <grid>
     <columns>
       <column flex="1"/>
       <column flex="1"/>
@@ -31,14 +39,12 @@
     </rows>
   </grid>
   
   <hbox id="prompt-password-checkbox-box" collapsed="true" align="center" class="prompt-message">
     <description id="prompt-password-checkbox-msg"/>
     <checkbox class="toggle-dark" id="prompt-password-checkbox"/>
   </hbox>
   <hbox pack="center" id="prompt-password-button-box" class="prompt-buttons">
-    <button class="button-dark" label="&ok.label;"
-            oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(true)"/>
-    <button class="button-dark" label="&cancel.label;"
-            oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(false)"/>
+    <button class="button-dark" label="&ok.label;" command="cmd_ok"/>
+    <button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
   </hbox>
 </dialog>
--- a/mobile/chrome/content/prompt/select.xul
+++ b/mobile/chrome/content/prompt/select.xul
@@ -1,18 +1,25 @@
 <?xml version="1.0"?>
 <!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
 <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       id="prompt-select-dialog"
-      script="chrome://browser/content/prompt/prompt.js"
-      onclose="this.PromptHelper.onCloseSelect(this)">
+      onload="document.getElementById('prompt-select-list').focus()"
+      onclose="this.PromptHelper.onCloseSelect(this)"
+      script="chrome://browser/content/prompt/prompt.js">
+  <keyset>
+    <key keycode="VK_RETURN" command="cmd_ok"/>
+    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
+  </keyset>
+  <commandset>
+    <command id="cmd_ok" oncommand="document.getElementById('prompt-alert-dialog').PromptHelper.closeSelect(true)"/>
+    <command id="cmd_cancel" oncommand="document.getElementById('prompt-alert-dialog').PromptHelper.closeSelect(false)"/>
+  </commandset>
   <label id="prompt-select-title"/>
   <scrollbox orient="vertical" class="prompt-message">
     <description id="prompt-select-message"/>
   </scrollbox>
   <menulist id="prompt-select-list" class="button-dark"/>
   <hbox pack="center" id="prompt-prompt-button-box" class="prompt-buttons">
-    <button class="button-dark" label="&ok.label;"
-            oncommand="document.getElementById('prompt-select-dialog').PromptHelper.closeSelect(true);"/>
-    <button class="button-dark" label="&cancel.label;"
-            oncommand="document.getElementById('prompt-select-dialog').PromptHelper.closeSelect(false)"/>
+    <button class="button-dark" label="&ok.label;" command="cmd_ok;"/>
+    <button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
   </hbox>
 </dialog>