Skip to content

Commit

Permalink
Replace .sr-only -> .visually-hidden, use static Helper where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
vrozkovec committed Dec 4, 2023
1 parent 580869a commit 62e2049
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<button type="button" class="btn" wicket:id="button"></button>
<button type="button" class="btn dropdown-toggle dropdown-toggle-split" wicket:id="caret"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only"></span>
<span class="visually-hidden"></span>
</button>
<div wicket:id="dropdown-menu" class="dropdown-menu">
<wicket:container wicket:id="buttons">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel><span wicket:id="srOnly" class="sr-only"></span></wicket:panel>
<wicket:panel><span wicket:id="srOnly"></span></wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.agilecoders.wicket.core.markup.html.bootstrap.components.progress;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
Expand All @@ -9,6 +10,7 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.utilities.BackgroundColorBehavior;
import de.agilecoders.wicket.core.util.Attributes;
import de.agilecoders.wicket.core.util.CssClassNames.Helper;

/**
* Represents a stack of the progress bar.
Expand Down Expand Up @@ -57,6 +59,7 @@ protected void onInitialize() {
super.onInitialize();

srOnly = new Label("srOnly", createLabelModel());
srOnly.add(AttributeModifier.append("class", Helper.screenReaderOnly));
add(srOnly);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import de.agilecoders.wicket.core.WicketApplicationTest;
import de.agilecoders.wicket.core.markup.html.bootstrap.utilities.BackgroundColorBehavior;
import de.agilecoders.wicket.core.util.CssClassNames.Helper;

/**
* Tests for ProgressBar
Expand Down Expand Up @@ -58,7 +59,7 @@ void progressBarWithDefaultStackMarkup() {
assertEquals("" + ProgressBar.MIN, stackTester.getAttribute("aria-valuemin"));
assertEquals("" + ProgressBar.MAX, stackTester.getAttribute("aria-valuemax"));

TagTester stackLabelTester = stackTester.getChild("class", "sr-only");
TagTester stackLabelTester = stackTester.getChild("class", Helper.screenReaderOnly);
assertEquals("" + progress + "%", stackLabelTester.getValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapAjaxButton;
import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
import de.agilecoders.wicket.core.util.CssClassNames.Helper;

/**
* A specialization of {@link de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapAjaxButton}
Expand Down Expand Up @@ -107,7 +108,7 @@ protected void onConfigure() {
super.onConfigure();
Component label = get("label");
if (Strings.isEmpty(label.getDefaultModelObjectAsString())) {
label.add(AttributeModifier.append("class", "sr-only"));
label.add(AttributeModifier.append("class", Helper.screenReaderOnly));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapAjaxLink;
import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
import de.agilecoders.wicket.core.util.CssClassNames.Helper;

/**
* A specialization of {@link de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapAjaxLink}
Expand Down Expand Up @@ -102,7 +103,7 @@ protected void onConfigure() {
super.onConfigure();
Component label = get("label");
if (Strings.isEmpty(label.getDefaultModelObjectAsString())) {
label.add(AttributeModifier.append("class", "sr-only"));
label.add(AttributeModifier.append("class", Helper.screenReaderOnly));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<body style="padding-top: 60px">
<a name="top" style="display: none;"></a>
<a class="sr-only" href="#content">Skip navigation</a>
<a class="visually-hidden" href="#content">Skip navigation</a>

<header wicket:id="navbar" class="bs-docs-nav"></header>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1538,14 +1538,14 @@ <h3>Pills</h3>
<div class="mb-2 p-2">
<a href="#" wicket:id="button-with-badge">
Submit <span wicket:id="badge"></span>
<span class="sr-only">unread messages</span>
<span class="visually-hidden">unread messages</span>
</a>
</div>

<pre class="prettyprint linenum">
&lt;button wicket:id="badge-button"&gt;
Submit &lt;span wicket:id="button-count"&gt;&lt;/span&gt;
&lt;span class="sr-only"&gt;unread messages&lt;/span&gt;
&lt;span class="visually-hidden"&gt;unread messages&lt;/span&gt;
&lt;/button&gt;
</pre>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h2>Example</h2>
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal">
<span class="sr-only">Close</span>
<span class="visually-hidden">Close</span>
</button>
</div>
<div class="modal-body">
Expand Down

0 comments on commit 62e2049

Please sign in to comment.