Skip to content

Commit de47520

Browse files
authored
fix: keep invisible texts out of the view port (#3085)
Add negative coordinates to the a11y invisible texts to ensure they remain out of the view port. Already this is the case in most of the browsers, but on IE they can be still observed. The negative coordinates do not affect the a11y and do not prevent Screen Readers from announcing the texts. FIXES: #2723 CLOSES: #2723
1 parent 6ee46e0 commit de47520

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

packages/fiori/src/themes/InvisibleTextStyles.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
position: absolute;
33
clip: rect(1px,1px,1px,1px);
44
user-select: none;
5-
left: 0;
6-
top: 0;
5+
left: -1000px; /* ensure the invisible texts are never part of the viewport */
6+
top: -1000px;
7+
pointer-events: none;
78
}

packages/fiori/test/pages/Wizard_test.html

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
<ui5-switch id="sw"></ui5-switch>
9393
</div>
9494

95+
<span id="scrollMarkerSt2"></span>
9596
<div id="pureContent" style="height: 1800px; background-color: red; display:none;">
9697
</div>
9798
</div>
@@ -138,6 +139,8 @@
138139
</div>
139140
</div>
140141

142+
<span id="scrollMarkerSt3"></span>
143+
141144
<ui5-button id="toStep22" design="Emphasized">Step 2</ui5-button>
142145
<ui5-button id="toStep4" design="Emphasized">Step 4</ui5-button>
143146
</ui5-wizard-step>

packages/fiori/test/specs/Wizard.spec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,15 @@ describe("Wizard general interaction", () => {
141141
it("move to next step by scroll", () => {
142142
const wiz = browser.$("#wizTest");
143143
const step2 = browser.$("#st2");
144+
const scrollMarker = browser.$("#scrollMarkerSt2");
144145
const step2InHeader = wiz.shadow$(`[data-ui5-index="2"]`);
145146
const inpSelectionChangeCounter = browser.$("#inpSelectionChangeCounter");
146147
const inpSelectionChangeCause = browser.$("#inpSelectionChangeCause");
147148

148149
// act - scroll the 2nd step into view
149150
// Note: scrollIntoView works in Chrome, but if we start executing the test on every browser,
150151
// this test should be reworked.
151-
step2.scrollIntoView();
152+
scrollMarker.scrollIntoView();
152153
browser.pause(500);
153154

154155
// assert - that second step in the content and in the header are properly selected
@@ -171,13 +172,14 @@ describe("Wizard general interaction", () => {
171172
const btnToStep2 = browser.$("#toStep22");
172173
const btnToStep3 = browser.$("#toStep3");
173174
const step3 = browser.$("#st3");
175+
const scrollMarker = browser.$("#scrollMarkerSt3");
174176
const step3InHeader = wiz.shadow$(`[data-ui5-index="3"]`);
175177
const inpSelectionChangeCounter = browser.$("#inpSelectionChangeCounter");
176178

177179
btnToStep3.click(); // click to enable step 3
178180
btnToStep2.click(); // click to get back to step 2
179181
sw.click(); // click to dynamically expand content in step 2
180-
step3.scrollIntoView(); // scroll to step 3
182+
scrollMarker.scrollIntoView(); // scroll to step 3
181183
browser.pause(500);
182184

183185
assert.strictEqual(step3.getAttribute("selected"), "true",

packages/main/src/themes/InvisibleTextStyles.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
position: absolute;
33
clip: rect(1px,1px,1px,1px);
44
user-select: none;
5-
left: 0;
6-
top: 0;
5+
left: -1000px; /* ensure the invisible texts are never part of the viewport */
6+
top: -1000px;
7+
pointer-events: none;
78
}

0 commit comments

Comments
 (0)