Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/scss
diff options
context:
space:
mode:
authorPatrick H. Lauke <redux@splintered.co.uk>2020-12-12 00:28:45 +0300
committerXhmikosR <xhmikosr@gmail.com>2020-12-15 10:22:14 +0300
commiteae52b1cb0af18c5bf3fddd660f53d58d689cd63 (patch)
tree5bda1d015ef474c9ba5180b3c61c3d344fa9a2e7 /scss
parent9b6c81514831038646fb921e8fbacf702a56be04 (diff)
Expand `visually-hidden-focusable` so it can be used on a container, so the container becomes visible when focus is inside it / on one of its child elements.
Diffstat (limited to 'scss')
-rw-r--r--scss/helpers/_visually-hidden.scss2
-rw-r--r--scss/mixins/_visually-hidden.scss5
2 files changed, 4 insertions, 3 deletions
diff --git a/scss/helpers/_visually-hidden.scss b/scss/helpers/_visually-hidden.scss
index 0a843d383d..4760ff03d1 100644
--- a/scss/helpers/_visually-hidden.scss
+++ b/scss/helpers/_visually-hidden.scss
@@ -3,6 +3,6 @@
//
.visually-hidden,
-.visually-hidden-focusable:not(:focus) {
+.visually-hidden-focusable:not(:focus):not(:focus-within) {
@include visually-hidden();
}
diff --git a/scss/mixins/_visually-hidden.scss b/scss/mixins/_visually-hidden.scss
index d980696c80..ed7bc9c13a 100644
--- a/scss/mixins/_visually-hidden.scss
+++ b/scss/mixins/_visually-hidden.scss
@@ -17,12 +17,13 @@
border: 0 !important;
}
-// Use to only display content when it's focused.
+// Use to only display content when it's focused, or one of its child elements is focused
+// (i.e. when focus is within the element/container that the class was applied to)
//
// Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
@mixin visually-hidden-focusable() {
- &:not(:focus) {
+ &:not(:focus):not(:focus-within) {
@include visually-hidden();
}
}