Browse Source

fix: Show focus indicator only when navigating via keyboard

master
Mihai Uscat 4 years ago
parent
commit
5e2ee3bdcd
5 changed files with 17 additions and 0 deletions
  1. 2
    0
      app.js
  2. 8
    0
      css/_base.scss
  3. 5
    0
      package-lock.json
  4. 1
    0
      package.json
  5. 1
    0
      webpack.config.js

+ 2
- 0
app.js View File

@@ -6,6 +6,8 @@ import 'jQuery-Impromptu';
6 6
 
7 7
 import 'olm';
8 8
 
9
+import 'focus-visible';
10
+
9 11
 // We need to setup the jitsi-local-storage as early as possible so that we can start using it.
10 12
 // NOTE: If jitsi-local-storage is used before the initial setup is performed this will break the use case when we use
11 13
 // the  local storage from the parent page when the localStorage is disabled. Also the setup is relying that

+ 8
- 0
css/_base.scss View File

@@ -33,6 +33,14 @@ body {
33 33
     }
34 34
 }
35 35
 
36
+/**
37
+ * This will hide the focus indicator if an element receives focus via the mouse,
38
+ * but it will still show up on keyboard focus, thus preserving accessibility.
39
+ */
40
+.js-focus-visible :focus:not(.focus-visible) {
41
+  outline: none;
42
+}
43
+
36 44
 /**
37 45
  * AtlasKit sets a default margin on the rendered modals, so
38 46
  * when the shift-right class is set when the chat opens, we

+ 5
- 0
package-lock.json View File

@@ -8772,6 +8772,11 @@
8772 8772
       "resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.6.3.tgz",
8773 8773
       "integrity": "sha512-EU6ePgEauhWrzJEN5RtG1d1ayrWXhEnfzTjnieHj+jG9tNHDEhKTAnCn1TN3gs9h6XWCDH6cpeX1VXY/lzLwZg=="
8774 8774
     },
8775
+    "focus-visible": {
8776
+      "version": "5.1.0",
8777
+      "resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.1.0.tgz",
8778
+      "integrity": "sha512-nPer0rjtzdZ7csVIu233P2cUm/ks/4aVSI+5KUkYrYpgA7ujgC3p6J7FtFU+AIMWwnwYQOB/yeiOITxFeYIXiw=="
8779
+    },
8775 8780
     "follow-redirects": {
8776 8781
       "version": "1.11.0",
8777 8782
       "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.11.0.tgz",

+ 1
- 0
package.json View File

@@ -45,6 +45,7 @@
45 45
     "base64-js": "1.3.1",
46 46
     "bc-css-flags": "3.0.0",
47 47
     "dropbox": "4.0.9",
48
+    "focus-visible": "5.1.0",
48 49
     "i18n-iso-countries": "3.7.8",
49 50
     "i18next": "17.0.6",
50 51
     "i18next-browser-languagedetector": "3.0.1",

+ 1
- 0
webpack.config.js View File

@@ -171,6 +171,7 @@ const config = {
171 171
     ].filter(Boolean),
172 172
     resolve: {
173 173
         alias: {
174
+            'focus-visible': 'focus-visible/dist/focus-visible.min.js',
174 175
             jquery: `jquery/dist/jquery${minimize ? '.min' : ''}.js`
175 176
         },
176 177
         aliasFields: [

Loading…
Cancel
Save