Skip to content

Commit

Permalink
Rename sr-only/sr-only-focusable (#31139)
Browse files Browse the repository at this point in the history
* Rename `sr-only`/`sr-only-focusable`

To be more representative of the fact that these are not necessarily "screen reader" specific, but actually apply to assistive technologies in general (and also things like Alexa/Siri/etc). Goes hand-in-hand with #31133

Co-authored-by: XhmikosR <[email protected]>
  • Loading branch information
patrickhlauke and XhmikosR authored Jul 3, 2020
1 parent 0a6cf90 commit 10690dd
Show file tree
Hide file tree
Showing 21 changed files with 104 additions and 99 deletions.
4 changes: 2 additions & 2 deletions js/tests/integration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ <h5>Third slide label</h5>
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions js/tests/visual/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ <h1>Carousel <small>Bootstrap Visual Test</small></h1>
</div>
<a class="carousel-control-prev" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-example-generic" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions js/tests/visual/dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-link" href="#">Home <span class="visually-hidden">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
Expand Down Expand Up @@ -70,7 +70,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="btn-group dropup">
<button type="button" class="btn btn-secondary">Dropup split</button>
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Dropup split</span>
<span class="visually-hidden">Dropup split</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -104,7 +104,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="btn-group dropup" role="group">
<a href="#" class="btn btn-secondary">Dropup split align right</a>
<button type="button" id="dropdown-page-subheader-button-3" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Product actions</span>
<span class="visually-hidden">Product actions</span>
</button>
<div class="dropdown-menu dropdown-menu-right">
<button class="dropdown-item" type="button">Action</button>
Expand All @@ -126,7 +126,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="btn-group dropright" role="group">
<a href="#" class="btn btn-secondary">Dropright split</a>
<button type="button" id="dropdown-page-subheader-button-4" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Product actions</span>
<span class="visually-hidden">Product actions</span>
</button>
<div class="dropdown-menu">
<button class="dropdown-item" type="button">Action</button>
Expand All @@ -148,7 +148,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="btn-group dropleft" role="group">
<a href="#" class="btn btn-secondary">Dropleft split</a>
<button type="button" id="dropdown-page-subheader-button-5" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Product actions</span>
<span class="visually-hidden">Product actions</span>
</button>
<div class="dropdown-menu">
<button class="dropdown-item" type="button">Action</button>
Expand Down Expand Up @@ -184,7 +184,7 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
<div class="btn-group dropdown">
<button type="button" class="btn btn-secondary">Dropdown reference</button>
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false" data-reference="parent">
<span class="sr-only">Dropdown split</span>
<span class="visually-hidden">Dropdown split</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down
2 changes: 1 addition & 1 deletion js/tests/visual/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a class="navbar-brand" href="#">This shouldn't jump!</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-link" href="#">Home <span class="visually-hidden">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
Expand Down
6 changes: 3 additions & 3 deletions scss/helpers/_screenreaders.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Screenreaders
//

.sr-only,
.sr-only-focusable:not(:focus) {
@include sr-only();
.visually-hidden,
.visually-hidden-focusable:not(:focus) {
@include visually-hidden();
}
6 changes: 3 additions & 3 deletions scss/mixins/_screen-reader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See: https://a11yproject.com/posts/how-to-hide-content/
// See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/

@mixin sr-only {
@mixin visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
Expand All @@ -21,8 +21,8 @@
//
// Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1

@mixin sr-only-focusable {
@mixin visually-hidden-focusable {
&:not(:focus) {
@include sr-only();
@include visually-hidden();
}
}
2 changes: 1 addition & 1 deletion site/content/docs/5.0/components/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Unless the context is clear (as with the "Notifications" example, where it is un
{{< example >}}
<button type="button" class="btn btn-primary">
Profile <span class="badge bg-secondary">9</span>
<span class="sr-only">unread messages</span>
<span class="visually-hidden">unread messages</span>
</button>
{{< /example >}}

Expand Down
20 changes: 10 additions & 10 deletions site/content/docs/5.0/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ Adding in the previous and next controls:
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
{{< /example >}}
Expand Down Expand Up @@ -96,11 +96,11 @@ You can also add the indicators to the carousel, alongside the controls, too.
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
{{< /example >}}
Expand Down Expand Up @@ -141,11 +141,11 @@ Add captions to your slides easily with the `.carousel-caption` element within a
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
{{< /example >}}
Expand All @@ -169,11 +169,11 @@ Add `.carousel-fade` to your carousel to animate slides with a fade transition i
</div>
<a class="carousel-control-prev" href="#carouselExampleFade" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleFade" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
{{< /example >}}
Expand All @@ -197,11 +197,11 @@ Add `data-interval=""` to a `.carousel-item` to change the amount of time to del
</div>
<a class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleInterval" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</a>
</div>
{{< /example >}}
Expand Down
36 changes: 18 additions & 18 deletions site/content/docs/5.0/components/dropdowns.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -161,7 +161,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -174,7 +174,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -187,7 +187,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -200,7 +200,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-warning dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -213,7 +213,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -230,7 +230,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<div class="btn-group">
<button type="button" class="btn btn-danger">Action</button>
<button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -263,7 +263,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
<div class="btn-group ml-2">
<button type="button" class="btn btn-lg btn-secondary">Large split button</button>
<button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand All @@ -290,7 +290,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
<div class="btn-group ml-2">
<button type="button" class="btn btn-sm btn-secondary">Small split button</button>
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -318,7 +318,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
Large split button
</button>
<button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
...
Expand All @@ -339,7 +339,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
Small split button
</button>
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
...
Expand Down Expand Up @@ -371,7 +371,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
Split dropup
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -400,7 +400,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
Split dropup
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<!-- Dropdown menu links -->
Expand Down Expand Up @@ -430,7 +430,7 @@ Trigger dropdown menus at the right of the elements by adding `.dropright` to th
Split dropright
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropright</span>
<span class="visually-hidden">Toggle Dropright</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -459,7 +459,7 @@ Trigger dropdown menus at the right of the elements by adding `.dropright` to th
Split dropright
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropright</span>
<span class="visually-hidden">Toggle Dropright</span>
</button>
<ul class="dropdown-menu">
<!-- Dropdown menu links -->
Expand Down Expand Up @@ -487,7 +487,7 @@ Trigger dropdown menus at the left of the elements by adding `.dropleft` to the
<div class="btn-group">
<div class="btn-group dropleft" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropleft</span>
<span class="visually-hidden">Toggle Dropleft</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down Expand Up @@ -518,7 +518,7 @@ Trigger dropdown menus at the left of the elements by adding `.dropleft` to the
<div class="btn-group">
<div class="btn-group dropleft" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropleft</span>
<span class="visually-hidden">Toggle Dropleft</span>
</button>
<ul class="dropdown-menu">
<!-- Dropdown menu links -->
Expand Down Expand Up @@ -754,7 +754,7 @@ Use `data-offset` or `data-reference` to change the location of the dropdown.
<div class="btn-group">
<button type="button" class="btn btn-secondary">Reference</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" id="dropdownMenuReference" data-toggle="dropdown" aria-expanded="false" data-reference="parent">
<span class="sr-only">Toggle Dropdown</span>
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuReference">
<li><a class="dropdown-item" href="#">Action</a></li>
Expand Down
Loading

0 comments on commit 10690dd

Please sign in to comment.