Bug 1242851 - adding keyboard focus styles for better accessibility. r=bgrins draft
authorYura Zenevich <yzenevich@mozilla.com>
Mon, 02 May 2016 13:47:55 -0400
changeset 358374 7c3f6f8a7193a8f124a049e051d6a02788ea7eba
parent 358327 77cead2cd20300623eea2416bc9bce4d5021df09
child 519839 df1bde1007a5d30f5cec7e384d55668c2b640317
push id16992
push useryura.zenevich@gmail.com
push dateMon, 02 May 2016 17:48:17 +0000
reviewersbgrins
bugs1242851
milestone49.0a1
Bug 1242851 - adding keyboard focus styles for better accessibility. r=bgrins MozReview-Commit-ID: Cb6JO5OxAay --- devtools/client/framework/toolbox-options.xhtml | 2 +- devtools/client/themes/common.css | 26 +++++++++++++++++++++++++ devtools/client/themes/toolbars.css | 19 +++++++++++------- devtools/client/themes/variables.css | 20 +++++++++++++++++++ devtools/client/themes/webconsole.css | 9 ++++++++- devtools/client/themes/widgets.css | 9 +++++++++ 6 files changed, 76 insertions(+), 9 deletions(-)
devtools/client/framework/toolbox-options.xhtml
devtools/client/themes/common.css
devtools/client/themes/toolbars.css
devtools/client/themes/variables.css
devtools/client/themes/webconsole.css
devtools/client/themes/widgets.css
--- a/devtools/client/framework/toolbox-options.xhtml
+++ b/devtools/client/framework/toolbox-options.xhtml
@@ -11,17 +11,17 @@
     <title>Toolbox option</title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <link rel="stylesheet" href="chrome://devtools/content/framework/options-panel.css" type="text/css"/>
     <script type="application/javascript;version=1.8" src="chrome://devtools/content/shared/theme-switching.js"/>
   </head>
   <body role="application" class="theme-body">
   <form id="options-panel">
     <div id="tools-box" class="options-vertical-pane">
-      <fieldset id="default-tools-box" class="options-groupbox" tabindex="0">
+      <fieldset id="default-tools-box" class="options-groupbox">
         <legend>&options.selectDefaultTools.label;</legend>
       </fieldset>
 
       <fieldset id="additional-tools-box" class="options-groupbox">
         <legend>&options.selectAdditionalTools.label;</legend>
       </fieldset>
 
       <fieldset id="enabled-toolbox-buttons-box" class="options-groupbox">
--- a/devtools/client/themes/common.css
+++ b/devtools/client/themes/common.css
@@ -259,8 +259,34 @@
   cursor: pointer;
 }
 
 .devtools-source-link > .line-number {
   flex: none;
   margin: 2px 0px;
   cursor: pointer;
 }
+
+/* Keyboard focus highlight styles */
+
+:-moz-focusring {
+  outline: var(--theme-focus-outline);
+  outline-offset: -1px;
+}
+
+textbox[focused="true"] {
+  border-color: var(--theme-focus-border-color-textbox);
+  box-shadow: var(--theme-focus-box-shadow-textbox);
+  transition: all 0.2s ease-in-out
+}
+
+textbox :-moz-focusring {
+  box-shadow: none;
+  outline: none;
+}
+
+/* Form fields should already have box-shadow hightlight */
+select:-moz-focusring,
+input[type="radio"]:-moz-focusring,
+input[type="checkbox"]:-moz-focusring,
+checkbox:-moz-focusring {
+  outline: none;
+}
--- a/devtools/client/themes/toolbars.css
+++ b/devtools/client/themes/toolbars.css
@@ -145,23 +145,16 @@
 .devtools-menulist,
 .devtools-toolbarbutton {
   -moz-box-align: center;
   min-width: 78px;
   padding: 1px;
   margin: 2px 1px;
 }
 
-.devtools-menulist:-moz-focusring,
-.devtools-toolbarbutton:-moz-focusring,
-.devtools-button:-moz-focusring {
-  outline: 1px dotted hsla(210,30%,85%,0.7);
-  outline-offset: -1px;
-}
-
 .devtools-toolbarbutton:not([label]) > .toolbarbutton-icon,
 .devtools-button::before {
   width: 16px;
   height: 16px;
   transition: opacity 0.05s ease-in-out;
 }
 
 /* HTML buttons */
@@ -180,16 +173,20 @@
   left: 50%;
   top: 50%;
   margin: -8px 0 0 -8px;
   background-size: cover;
   background-repeat: no-repeat;
   transition: opacity 0.05s ease-in-out;
 }
 
+.devtools-button:-moz-focusring {
+  outline: none;
+}
+
 /* Standalone buttons */
 .devtools-button[standalone],
 .devtools-button[data-standalone],
 .devtools-toolbarbutton[standalone],
 .devtools-toolbarbutton[data-standalone] {
   border-width: 1px;
   border-style: solid;
   min-height: 32px;
@@ -431,16 +428,24 @@
 
 /* The spacing is accomplished with a padding on the searchbox */
 .devtools-searchbox > .devtools-textinput,
 .devtools-searchbox > .devtools-searchinput {
   margin-left: 0;
   margin-right: 0;
 }
 
+.devtools-searchbox > .devtools-textinput:-moz-focusring,
+.devtools-searchbox > .devtools-searchinput:-moz-focusring {
+  border-color: var(--theme-focus-border-color-textbox);
+  box-shadow: var(--theme-focus-box-shadow-textbox);
+  transition: all 0.2s ease-in-out;
+  outline: none;
+}
+
 /* Don't add 'double spacing' for inputs that are at beginning / end
    of a toolbar (since the toolbar has it's own spacing). */
 .devtools-toolbar > .devtools-textinput:first-child,
 .devtools-toolbar > .devtools-searchinput:first-child {
   -moz-margin-start: 0;
 }
 .devtools-toolbar > .devtools-textinput:last-child,
 .devtools-toolbar > .devtools-searchinput:last-child {
--- a/devtools/client/themes/variables.css
+++ b/devtools/client/themes/variables.css
@@ -38,16 +38,20 @@
   --theme-highlight-blue: #0088cc;
   --theme-highlight-bluegrey: #0072ab;
   --theme-highlight-purple: #5b5fff;
   --theme-highlight-lightorange: #d97e00;
   --theme-highlight-orange: #f13c00;
   --theme-highlight-red: #ed2655;
   --theme-highlight-pink: #b82ee5;
 
+  /* For accessibility purposes we want to enhance the focus styling. This
+   * should improve keyboard navigation usability. */
+  --theme-focus-outline-color: #000000;
+
   /* Colors used in Graphs, like performance tools. Similar colors to Chrome's timeline. */
   --theme-graphs-green: #85d175;
   --theme-graphs-blue: #83b7f6;
   --theme-graphs-bluegrey: #0072ab;
   --theme-graphs-purple: #b693eb;
   --theme-graphs-yellow: #efc052;
   --theme-graphs-orange: #d97e00;
   --theme-graphs-red: #e57180;
@@ -84,16 +88,20 @@
   --theme-highlight-blue: #46afe3;
   --theme-highlight-bluegrey: #5e88b0;
   --theme-highlight-purple: #6b7abb;
   --theme-highlight-lightorange: #d99b28;
   --theme-highlight-orange: #d96629;
   --theme-highlight-red: #eb5368;
   --theme-highlight-pink: #df80ff;
 
+  /* For accessibility purposes we want to enhance the focus styling. This
+   * should improve keyboard navigation usability. */
+  --theme-focus-outline-color: #ced3d9;
+
   /* Colors used in Graphs, like performance tools. Mostly similar to some "highlight-*" colors. */
   --theme-graphs-green: #70bf53;
   --theme-graphs-blue: #46afe3;
   --theme-graphs-bluegrey: #5e88b0;
   --theme-graphs-purple: #df80ff;
   --theme-graphs-yellow: #d99b28;
   --theme-graphs-orange: #d96629;
   --theme-graphs-red: #eb5368;
@@ -153,8 +161,20 @@
   /* Font size */
   --theme-toolbar-font-size: 12px;
 
   /* Header */
   --theme-header-background: #F0F0F0 linear-gradient(to top,
                                                      rgba(0, 0, 0, 0.1),
                                                      transparent) repeat-x;
 }
+
+:root {
+  --theme-focus-border-color-textbox: #0675d3;
+  --theme-textbox-box-shadow: rgba(97,181,255,.75);
+
+  /* For accessibility purposes we want to enhance the focus styling. This
+   * should improve keyboard navigation usability. */
+  --theme-focus-outline: 1px dotted var(--theme-focus-outline-color);
+  --theme-focus-box-shadow-textbox: 0 0 0 1px var(--theme-textbox-box-shadow);
+  --theme-focus-box-shadow-inset-bottom: 0 -2px 1px var(--theme-textbox-box-shadow) inset,
+    0px -2px var(--theme-highlight-blue) inset;
+}
--- a/devtools/client/themes/webconsole.css
+++ b/devtools/client/themes/webconsole.css
@@ -401,32 +401,39 @@ a {
 
 .theme-firebug .jsterm-input-container {
   border-top: 1px solid #ccc;
 }
 
 .jsterm-input-node,
 .jsterm-complete-node {
   border: none;
-  padding: 0 0 0 16px;
+  padding: 4px;
+  padding-inline-start: 20px;
+  margin: 0;
   -moz-appearance: none;
   background-color: transparent;
 }
 
+.jsterm-input-node[focused="true"] {
+  box-shadow: var(--theme-focus-box-shadow-inset-bottom);
+}
+
 .jsterm-complete-node {
   color: var(--theme-comment);
 }
 
 .jsterm-input-node {
   /* Always allow scrolling on input - it auto expands in js by setting height,
      but don't want it to get bigger than the window. 24px = toolbar height. */
   max-height: calc(90vh - 24px);
   background-image: var(--command-line-image);
   background-repeat: no-repeat;
   background-size: 16px 16px;
+  background-position: 4px 50%;
   color: var(--theme-content-color1);
 }
 
 @media (min-resolution: 1.1dppx) {
   .jsterm-input-node {
     background-image: var(--command-line-image-2x);
   }
 }
--- a/devtools/client/themes/widgets.css
+++ b/devtools/client/themes/widgets.css
@@ -244,16 +244,25 @@
   min-width: 65px;
   margin: 0;
   padding: 0 8px 0 20px;
   border: none;
   outline: none;
   color: hsl(210,30%,85%);
 }
 
+.breadcrumbs-widget-item:-moz-focusring {
+  outline: none;
+}
+
+.breadcrumbs-widget-item[checked]:-moz-focusring > .button-box {
+  outline: var(--theme-focus-outline);
+  outline-offset: -1px;
+}
+
 .breadcrumbs-widget-item > .button-box {
   border: none;
   padding-top: 0;
   padding-bottom: 0;
 }
 
 :root[platform="win"] .breadcrumbs-widget-item:-moz-focusring > .button-box {
   border-width: 0;