Skip to content

Commit

Permalink
MDL-80519 theme: Add backward compatibility for sr-only
Browse files Browse the repository at this point in the history
  • Loading branch information
roland04 committed Nov 11, 2024
1 parent 5e1d38e commit b0ba011
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
33 changes: 33 additions & 0 deletions theme/boost/scss/moodle/bs4-compat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,36 @@ a.close.disabled {
.rounded-lg {
border-radius: $border-radius-lg !important;
}

// Screen reader only.
@mixin sr-only() {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px; // Fix for https://github.com/twbs/bootstrap/issues/25686
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}

@mixin sr-only-focusable() {
&:active,
&:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
clip: auto;
white-space: normal;
}
}

.sr-only {
@include sr-only();
}

.sr-only-focusable {
@include sr-only-focusable();
}
21 changes: 21 additions & 0 deletions theme/boost/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -25535,6 +25535,27 @@ a.close.disabled, a.disabled.btn-close {
border-radius: 0.6rem !important;
}

.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}

.sr-only-focusable:active, .sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
clip: auto;
white-space: normal;
}

/**
* Moodle variables
*
Expand Down
21 changes: 21 additions & 0 deletions theme/classic/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -25535,6 +25535,27 @@ a.close.disabled, a.disabled.btn-close {
border-radius: 0.3rem !important;
}

.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}

.sr-only-focusable:active, .sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
clip: auto;
white-space: normal;
}

/**
* Moodle variables
*
Expand Down

0 comments on commit b0ba011

Please sign in to comment.