Skip to content

Commit

Permalink
[pickers] Remove redundant aria-hidden (mui#26014)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 29, 2021
1 parent 684a0d5 commit d239c42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('<DesktopDateRangePicker />', () => {
expect(getAllByMuiTest('DateRangeHighlight')).to.have.length(31);
});

it('selects the range from the next month', () => {
it('selects the range from the next month', function test() {
const onChangeMock = spy();
render(
<DesktopDateRangePicker
Expand All @@ -188,9 +188,12 @@ describe('<DesktopDateRangePicker />', () => {
);

fireEvent.click(screen.getByLabelText('Jan 1, 2019'));
fireEvent.click(
screen.getByLabelText('Next month', { selector: ':not([aria-hidden="true"])' }),
);
// FIXME use `getByRole(role, {hidden: false})` and skip JSDOM once this suite can run in JSDOM
const [visibleButton] = screen.getAllByRole('button', {
hidden: true,
name: 'Next month',
});
fireEvent.click(visibleButton);
fireEvent.click(screen.getByLabelText('Mar 19, 2019'));

expect(onChangeMock.callCount).to.equal(2);
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-lab/src/PickersDay/PickersDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const PickersDay = React.forwardRef(function PickersDay<TDate>(
);

if (outsideCurrentMonth && !showDaysOutsideCurrentMonth) {
return <div aria-hidden className={clsx(dayClassName, classes.hiddenDaySpacingFiller)} />;
return <div className={clsx(dayClassName, classes.hiddenDaySpacingFiller)} />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const PickersArrowSwitcher = React.forwardRef(function PickersArrowSwitcher(
<div className={clsx(classes.root, className)} ref={ref} {...other}>
<LeftArrowButton
size="small"
aria-hidden={isLeftHidden}
aria-label={leftArrowButtonText}
title={leftArrowButtonText}
disabled={isLeftDisabled}
Expand All @@ -118,7 +117,6 @@ const PickersArrowSwitcher = React.forwardRef(function PickersArrowSwitcher(
)}
<RightArrowButton
size="small"
aria-hidden={isRightHidden}
aria-label={rightArrowButtonText}
title={rightArrowButtonText}
edge="start"
Expand Down

0 comments on commit d239c42

Please sign in to comment.