Aitema-gmbh commented on code in PR #39231:
URL: https://github.com/apache/superset/pull/39231#discussion_r3232634409
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx:
##########
@@ -76,6 +76,8 @@ const Header: FC<HeaderProps> = ({ toggleFiltersBar }) => (
buttonStyle="link"
buttonSize="xsmall"
onClick={() => toggleFiltersBar(false)}
+ aria-expanded
+ aria-label={t('Collapse filters')}
Review Comment:
Intentional — the Header component is only rendered inside the open
FilterBar (BarWrapper has `open: filtersOpen` class), so whenever the collapse
button exists, the panel is by definition expanded. Making the value dynamic
would be a state attribute that is mathematically constant from the user's
perspective. Static `aria-expanded="true"` is the correct WCAG signal — the
dynamic counterpart lives on the collapsed-bar trigger in Vertical.tsx.
Resolving.
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/Header.test.tsx:
##########
@@ -53,3 +53,21 @@ test('should toggle', () => {
userEvent.click(expandBtn);
expect(mockedProps.toggleFiltersBar).toHaveBeenCalled();
});
+
+test('collapse button should have aria-expanded attribute', () => {
+ const mockedProps = createProps();
+ render(<Header {...mockedProps} />, { useRedux: true });
+ const collapseBtn = screen.getByRole('button', {
+ name: 'vertical-align',
+ });
+ expect(collapseBtn).toHaveAttribute('aria-expanded', 'true');
+});
+
+test('collapse button should have aria-label for accessibility', () => {
+ const mockedProps = createProps();
+ render(<Header {...mockedProps} />, { useRedux: true });
+ const collapseBtn = screen.getByRole('button', {
+ name: 'vertical-align',
+ });
+ expect(collapseBtn).toHaveAttribute('aria-label', 'Collapse filters');
+});
Review Comment:
Addressed in 7a006443 — test selectors now use 'Collapse filters' (the
actual accessible name from aria-label) instead of 'vertical-align'. Resolving
— thanks for the catch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]