From 64ad4b603e62fbb39215a6c6d9443225c40208bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Poupard?= Date: Wed, 20 May 2020 15:43:18 +0200 Subject: [PATCH] feat(focus-visible): raw implementation --- js/index.esm.js | 1 + js/index.umd.js | 1 + package-lock.json | 6 ++++++ package.json | 1 + scss/_reboot.scss | 9 +++++++++ 5 files changed, 18 insertions(+) diff --git a/js/index.esm.js b/js/index.esm.js index d7ddb67f5a..7e0c56cc13 100644 --- a/js/index.esm.js +++ b/js/index.esm.js @@ -16,6 +16,7 @@ import ScrollSpy from './src/scrollspy' import Tab from './src/tab' import Toast from './src/toast' import Tooltip from './src/tooltip' +import '../node_modules/focus-visible/dist/focus-visible.js' // Boosted mod export { Alert, diff --git a/js/index.umd.js b/js/index.umd.js index ba8991d60c..b4fe8eeb19 100644 --- a/js/index.umd.js +++ b/js/index.umd.js @@ -16,6 +16,7 @@ import ScrollSpy from './src/scrollspy' import Tab from './src/tab' import Toast from './src/toast' import Tooltip from './src/tooltip' +import '../node_modules/focus-visible/dist/focus-visible.js' // Boosted mod export default { Alert, diff --git a/package-lock.json b/package-lock.json index 43f00cebbd..b1a16ed898 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5566,6 +5566,12 @@ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, + "focus-visible": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.1.0.tgz", + "integrity": "sha512-nPer0rjtzdZ7csVIu233P2cUm/ks/4aVSI+5KUkYrYpgA7ujgC3p6J7FtFU+AIMWwnwYQOB/yeiOITxFeYIXiw==", + "dev": true + }, "follow-redirects": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", diff --git a/package.json b/package.json index 05ef853111..1e1d5d4104 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "eslint-plugin-import": "^2.20.2", "eslint-plugin-unicorn": "^20.0.0", "find-unused-sass-variables": "^2.0.0", + "focus-visible": "^5.1.0", "glob": "^7.1.6", "hammer-simulator": "0.0.1", "hugo-bin": "^0.59.0", diff --git a/scss/_reboot.scss b/scss/_reboot.scss index b78e3eab04..8db7379187 100644 --- a/scss/_reboot.scss +++ b/scss/_reboot.scss @@ -70,6 +70,15 @@ body { outline: 0 !important; } +// Boosted mod +// Using the :focus-visible polyfill to hide outline defensively +// See https://github.com/WICG/focus-visible +.js-focus-visible :focus:not([data-focus-visible-added]), +.js-focus-visible .focus:not([data-focus-visible-added]) { + outline: 0 !important; +} +// End mod + // Content grouping //