Skip to content

Commit d531c83

Browse files
authored
chore: Resolve todo items (#3647)
1 parent 93089b2 commit d531c83

File tree

5 files changed

+7
-51
lines changed

5 files changed

+7
-51
lines changed

src/__a11y__/to-validate-a11y.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async function toValidateA11y(this: jest.MatcherUtils, element: HTMLElement) {
7575
);
7676
// TODO: remove polyfill with es2019 support
7777
const flattenAxeViolations = flatMap(axeViolations, violation =>
78-
violation.nodes.map(node => `${node.failureSummary} [${violation.id}]`)
78+
violation.nodes.map(node => `[${violation.id}] ${node.failureSummary} Selector: ${node.target}`)
7979
);
8080

8181
return compact(

src/__tests__/functional-tests/test-a11y-validator.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('a11y validator', () => {
4242
);
4343
await expect(expect(container).toValidateA11y()).rejects.toThrow(
4444
new Error(
45-
'Expected HTML to be valid but had the following errors:\nHTML validation\n1. Redundant "for" attribute [no-redundant-for]\nAxe checks\n1. Fix all of the following:\n ARIA attribute element ID does not exist on the page: aria-labelledby="non-exist-id" [aria-valid-attr-value]'
45+
'Expected HTML to be valid but had the following errors:\nHTML validation\n1. Redundant "for" attribute [no-redundant-for]\nAxe checks\n1. [aria-valid-attr-value] Fix all of the following:\n ARIA attribute element ID does not exist on the page: aria-labelledby="non-exist-id" Selector: #my-field'
4646
)
4747
);
4848
});

src/app-layout/__tests__/main.test.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describeEachAppLayout({ themes: ['classic', 'refresh-toolbar'], sizes: ['desktop
128128
await waitFor(() => expect(wrapper.getElement()).toHaveStyle({ minBlockSize: 'calc(100vh - 45px)' }));
129129
});
130130

131-
// TODO Enable after fixing disableBodyScroll
131+
// disableBodyScroll is not supported in this version
132132
(theme === 'refresh-toolbar' ? test.skip : test)(
133133
'should set height instead of min-height when the body scroll is disabled',
134134
() => {
@@ -139,8 +139,7 @@ describeEachAppLayout({ themes: ['classic', 'refresh-toolbar'], sizes: ['desktop
139139
);
140140
});
141141

142-
// TODO Enable after fixing 'Distinguish landmarks on page'
143-
(size === 'mobile' && theme !== 'refresh-toolbar' ? test : test.skip)('a11y', async () => {
142+
(size === 'mobile' ? test : test.skip)('a11y', async () => {
144143
const { container } = renderComponent(
145144
<AppLayout
146145
navigationOpen={true}
@@ -152,11 +151,9 @@ describeEachAppLayout({ themes: ['classic', 'refresh-toolbar'], sizes: ['desktop
152151
breadcrumbs={<div></div>}
153152
splitPanel={<div></div>}
154153
ariaLabels={{
155-
// notifications?: string;
156-
// navigation?: string;
154+
drawers: 'Drawers',
157155
navigationToggle: 'Open navigation',
158156
navigationClose: 'Close navigation',
159-
// tools?: string;
160157
toolsToggle: 'Open tools',
161158
toolsClose: 'Close tools',
162159
}}

src/app-layout/visual-refresh-toolbar/toolbar/index.tsx

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,7 @@ export function AppLayoutToolbarImplementation({
6363
// not testable in a single-version setup
6464
toolbarProps = {},
6565
}: AppLayoutToolbarImplementationProps) {
66-
const {
67-
breadcrumbs,
68-
discoveredBreadcrumbs,
69-
verticalOffsets,
70-
isMobile,
71-
toolbarState,
72-
setToolbarState,
73-
setToolbarHeight,
74-
} = appLayoutInternals;
66+
const { breadcrumbs, discoveredBreadcrumbs, verticalOffsets, isMobile, setToolbarHeight } = appLayoutInternals;
7567
const {
7668
ariaLabels,
7769
activeDrawerId,
@@ -93,8 +85,6 @@ export function AppLayoutToolbarImplementation({
9385
expandedDrawerId,
9486
setExpandedDrawerId,
9587
} = toolbarProps;
96-
// TODO: expose configuration property
97-
const pinnedToolbar = true;
9888
const drawerExpandedMode = !!expandedDrawerId;
9989
const ref = useRef<HTMLElement>(null);
10090
useResizeObserver(ref, entry => setToolbarHeight(entry.borderBoxHeight));
@@ -106,31 +96,6 @@ export function AppLayoutToolbarImplementation({
10696
// eslint-disable-next-line react-hooks/exhaustive-deps
10797
}, []);
10898

109-
useEffect(() => {
110-
let lastScrollY = window.scrollY;
111-
112-
/* istanbul ignore next not testable in JSDOM */
113-
const updateScrollDirection = () => {
114-
if (pinnedToolbar) {
115-
setToolbarState('show');
116-
return;
117-
}
118-
const scrollY = window.scrollY;
119-
// 80 is an arbitrary number to have a pause before the toolbar scrolls out of view at the top of the page
120-
const direction = scrollY > lastScrollY && scrollY > 80 ? 'hide' : 'show';
121-
// 2 as a buffer to avoid mistaking minor accidental mouse moves as scroll
122-
if (direction !== toolbarState && (scrollY - lastScrollY > 2 || scrollY - lastScrollY < -2)) {
123-
setToolbarState(direction);
124-
}
125-
lastScrollY = scrollY > 0 ? scrollY : 0;
126-
};
127-
128-
window.addEventListener('scroll', updateScrollDirection);
129-
return () => {
130-
window.removeEventListener('scroll', updateScrollDirection);
131-
};
132-
}, [pinnedToolbar, setToolbarState, toolbarState]);
133-
13499
const anyPanelOpenInMobile = !!isMobile && (!!activeDrawerId || (!!navigationOpen && !!hasNavigation));
135100
useEffect(() => {
136101
if (anyPanelOpenInMobile) {
@@ -143,7 +108,6 @@ export function AppLayoutToolbarImplementation({
143108
};
144109
}, [anyPanelOpenInMobile]);
145110

146-
const toolbarHidden = toolbarState === 'hide' && !pinnedToolbar;
147111
const navLandmarkAttributes = navigationOpen
148112
? { role: 'presentation' }
149113
: { role: 'navigation', 'aria-label': ariaLabels?.navigation };
@@ -153,10 +117,9 @@ export function AppLayoutToolbarImplementation({
153117
ref={ref}
154118
className={clsx(styles['universal-toolbar'], testutilStyles.toolbar, {
155119
[testutilStyles['mobile-bar']]: isMobile,
156-
[styles['toolbar-hidden']]: toolbarHidden,
157120
})}
158121
style={{
159-
insetBlockStart: toolbarHidden ? '-60px' : verticalOffsets.toolbar,
122+
insetBlockStart: verticalOffsets.toolbar,
160123
}}
161124
>
162125
<div className={styles['toolbar-container']}>

src/app-layout/visual-refresh-toolbar/toolbar/styles.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
inset-block-start: 0px;
2727
}
2828

29-
&.toolbar-hidden {
30-
opacity: 0;
31-
}
32-
3329
> .toolbar-container {
3430
block-size: 100%;
3531
align-items: center;

0 commit comments

Comments
 (0)