Skip to content

Commit fed271a

Browse files
author
Dobromir Hristov
committed
fix: make sure hidden item is hidden, even for Screen Readers and tab index
1 parent 593561a commit fed271a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/components/AdjustableSidebarWidth.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
:style="{ width: widthInPx, '--top-offset': `${mobileTopOffset}px` }"
2424
class="aside"
2525
ref="aside"
26+
:aria-hidden="closedExternally ? 'true': null"
2627
@transitionstart="isTransitioning = true"
2728
@transitionend="isTransitioning = false"
2829
>
@@ -345,11 +346,13 @@ export default {
345346
346347
@include breakpoints-from(large, nav) {
347348
&:not(.dragging) {
348-
transition: width 0.15s ease-in;
349+
transition: width 0.15s ease-in, visibility 0s linear 0s;
349350
}
350351
351352
&.force-close {
352353
width: 0 !important;
354+
visibility: hidden;
355+
transition: width 0.15s ease-in, visibility 0s linear 0.2s;
353356
}
354357
}
355358

tests/unit/components/AdjustableSidebarWidth.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ describe('AdjustableSidebarWidth', () => {
251251
closedExternally: true,
252252
},
253253
});
254-
expect(wrapper.find({ ref: 'aside' }).classes()).toContain('force-close');
254+
const aside = wrapper.find({ ref: 'aside' });
255+
expect(aside.classes()).toContain('force-close');
256+
expect(aside.attributes()).toMatchObject({
257+
'aria-hidden': 'true',
258+
});
255259
wrapper.setProps({ closedExternally: false });
256260
expect(wrapper.find({ ref: 'aside' }).classes()).not.toContain('force-close');
257261
});

0 commit comments

Comments
 (0)