浏览代码

fix: Show focus indicator only when navigating via keyboard

master
Mihai Uscat 4 年前
父节点
当前提交
5e2ee3bdcd
共有 5 个文件被更改,包括 17 次插入0 次删除
  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 查看文件

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

+ 8
- 0
css/_base.scss 查看文件

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
  * AtlasKit sets a default margin on the rendered modals, so
45
  * AtlasKit sets a default margin on the rendered modals, so
38
  * when the shift-right class is set when the chat opens, we
46
  * when the shift-right class is set when the chat opens, we

+ 5
- 0
package-lock.json 查看文件

8772
       "resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.6.3.tgz",
8772
       "resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.6.3.tgz",
8773
       "integrity": "sha512-EU6ePgEauhWrzJEN5RtG1d1ayrWXhEnfzTjnieHj+jG9tNHDEhKTAnCn1TN3gs9h6XWCDH6cpeX1VXY/lzLwZg=="
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
     "follow-redirects": {
8780
     "follow-redirects": {
8776
       "version": "1.11.0",
8781
       "version": "1.11.0",
8777
       "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.11.0.tgz",
8782
       "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.11.0.tgz",

+ 1
- 0
package.json 查看文件

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

+ 1
- 0
webpack.config.js 查看文件

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

正在加载...
取消
保存