Skip to content

Commit

Permalink
feat: Adds overflow aria label
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie George committed Aug 10, 2023
1 parent 270334d commit d7a08dd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions pages/app-layout/with-drawers.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function WithDrawers() {
: {
drawers: {
ariaLabel: 'Drawers',
overflowAriaLabel: 'Overflow triggers',
activeDrawerId: activeDrawerId,
items: [
{
Expand Down
1 change: 1 addition & 0 deletions src/app-layout/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export const DrawerTriggersBar = ({
}}
hasOverflowBadge={overflowItemHasBadge}
hasActiveStyles={overflowItemIsActive()}
ariaLabel={drawers.overflowAriaLabel}
/>
</span>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/app-layout/drawer/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface DrawerTriggersBarProps {
activeDrawerId?: string;
onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;
ariaLabel?: string;
overflowAriaLabel?: string;
};
}

Expand Down Expand Up @@ -86,5 +87,6 @@ export interface InternalDrawerProps {
onChange?: NonCancelableEventHandler<string>;
onResize?: NonCancelableEventHandler<{ size: number; id: string }>;
ariaLabel?: string;
overflowAriaLabel?: string;
};
}
5 changes: 3 additions & 2 deletions src/app-layout/drawer/overflow-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ interface OverflowMenuProps {
onItemClick: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;
hasOverflowBadge?: boolean;
hasActiveStyles?: boolean;
ariaLabel?: string;
}

export default function OverflowMenu(props: OverflowMenuProps) {
const { drawersRefs, className, overflowItems, onItemClick, hasOverflowBadge, hasActiveStyles } = props;
const { drawersRefs, className, overflowItems, onItemClick, hasOverflowBadge, hasActiveStyles, ariaLabel } = props;
return (
<InternalButtonDropdown
ref={drawersRefs ? drawersRefs.toggle : null}
Expand All @@ -64,7 +65,7 @@ export default function OverflowMenu(props: OverflowMenuProps) {
badge: item.badge,
}))}
onItemClick={onItemClick}
ariaLabel="Overflow drawer triggers"
ariaLabel={ariaLabel}
variant="icon"
customTriggerBuilder={getTrigger(hasOverflowBadge, hasActiveStyles)}
expandToViewport={true}
Expand Down
2 changes: 2 additions & 0 deletions src/app-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ const OldAppLayout = React.forwardRef(
}
},
ariaLabel: drawers.ariaLabel,
overflowAriaLabel: drawers.overflowAriaLabel,
}
: undefined
}
Expand Down Expand Up @@ -805,6 +806,7 @@ const OldAppLayout = React.forwardRef(
}
},
ariaLabel: drawers.ariaLabel,
overflowAriaLabel: drawers.overflowAriaLabel,
}}
/>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/app-layout/mobile-toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ interface MobileToolbarProps {
activeDrawerId: string | undefined;
onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;
ariaLabel?: string;
overflowAriaLabel?: string;
};
}

Expand Down Expand Up @@ -153,6 +154,7 @@ export function MobileToolbar({
});
}}
hasOverflowBadge={overflowItemHasBadge}
ariaLabel={drawers.overflowAriaLabel}
/>
</span>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/app-layout/visual-refresh/drawers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function DesktopTriggers() {
handleDrawersClick(detail.id);
}}
hasActiveStyles={true}
ariaLabel={drawers.overflowAriaLabel}

Check failure on line 303 in src/app-layout/visual-refresh/drawers.tsx

View workflow job for this annotation

GitHub Actions / build / build

'drawers' is possibly 'undefined'.

Check failure on line 303 in src/app-layout/visual-refresh/drawers.tsx

View workflow job for this annotation

GitHub Actions / Test for regressions

'drawers' is possibly 'undefined'.
/>
)}
{hasSplitPanel && splitPanelToggle.displayed && (
Expand Down Expand Up @@ -409,6 +410,7 @@ export function MobileTriggers() {
handleDrawersClick(detail.id);
}}
hasOverflowBadge={overflowItemHasBadge}
ariaLabel={drawers.overflowAriaLabel}
/>
)}
</aside>
Expand Down

0 comments on commit d7a08dd

Please sign in to comment.