Skip to content

Commit

Permalink
fix: [Search:Stateful:EnterpriseSearch:WorkplaceSearch:UsersandRoles]…
Browse files Browse the repository at this point in the history
…Assign to specific groups input combobox is missing form label (#202462)

Closes: #202234

## Description
Assign to specific groups input combobox on create a role mapping panel
on users and roles page should have a label so assistive technology can
help the user figure out which input they would want to select.

## Changes made:
1. required `aria-*` attribute was set for `EuiComboBox`

## Screen: 

<img width="1438" alt="image"
src="https://github.com/user-attachments/assets/b167aafd-b881-4a38-aedc-953858c13dcc">
  • Loading branch information
alexwizp authored Dec 5, 2024
1 parent 7caa339 commit 589a6ee
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import React from 'react';

import { useActions, useValues } from 'kea';

import { EuiComboBox, EuiFormRow, EuiHorizontalRule, EuiRadioGroup } from '@elastic/eui';
import {
EuiComboBox,
EuiFormRow,
EuiHorizontalRule,
EuiRadioGroup,
useGeneratedHtmlId,
} from '@elastic/eui';

import { RoleOptionLabel } from '../../../shared/role_mapping';

Expand All @@ -31,6 +37,8 @@ export const GroupAssignmentSelector: React.FC = () => {
const { includeInAllGroups, availableGroups, selectedGroups, selectedOptions } =
useValues(RoleMappingsLogic);

const groupAssigmentLabelId = useGeneratedHtmlId();

const hasGroupAssignment = selectedGroups.size > 0 || includeInAllGroups;

const groupOptions = [
Expand All @@ -51,11 +59,12 @@ export const GroupAssignmentSelector: React.FC = () => {
<EuiHorizontalRule />
<EuiFormRow>
<EuiRadioGroup
data-test-subj="enterpriseSearchGroupAssignmentSelectorRadioGroup"
options={groupOptions}
idSelected={includeInAllGroups ? 'all' : 'specific'}
onChange={(id) => handleAllGroupsSelectionChange(id === 'all')}
legend={{
children: <span>{GROUP_ASSIGNMENT_LABEL}</span>,
children: <span id={groupAssigmentLabelId}>{GROUP_ASSIGNMENT_LABEL}</span>,
}}
/>
</EuiFormRow>
Expand All @@ -69,6 +78,7 @@ export const GroupAssignmentSelector: React.FC = () => {
}}
fullWidth
isDisabled={includeInAllGroups}
aria-labelledby={groupAssigmentLabelId}
/>
</EuiFormRow>
</>
Expand Down

0 comments on commit 589a6ee

Please sign in to comment.