Skip to content

Commit

Permalink
fix a11y errors in settings
Browse files Browse the repository at this point in the history
varname

rename bodyText to ariaLabel
  • Loading branch information
jenny-s51 committed Feb 28, 2023
1 parent 0b996c1 commit 8850b5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/src/components/FormGroupSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const FormGroupSettings: React.FC<FormGroupSettingsProps> = ({
<FormGroup fieldId={groupsField} label={title}>
<Text>{body}</Text>
<MultiSelection
ariaLabel={body}
value={items}
setValue={(newState) => handleMenuItemSelection(newState, groupsField)}
/>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/MultiSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { MenuItemStatus } from '~/pages/groupSettings/groupTypes';
type MultiSelectionProps = {
value: MenuItemStatus[];
setValue: (itemSelection: MenuItemStatus[]) => void;
ariaLabel: string;
};

export const MultiSelection: React.FC<MultiSelectionProps> = ({ value, setValue }) => {
export const MultiSelection: React.FC<MultiSelectionProps> = ({ value, setValue, ariaLabel }) => {
const [showMenu, setShowMenu] = React.useState(false);

const toggleMenu = (isOpen: React.SetStateAction<boolean>) => {
Expand All @@ -33,6 +34,7 @@ export const MultiSelection: React.FC<MultiSelectionProps> = ({ value, setValue
removeFindDomNode
variant={SelectVariant.typeaheadMulti}
onToggle={toggleMenu}
typeAheadAriaLabel={ariaLabel}
onSelect={(e, newValue) => {
if (value?.filter((option) => option.name === newValue).length) {
const newState = value.map((element) =>
Expand Down

0 comments on commit 8850b5b

Please sign in to comment.