Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves screen reader features of combo boxes in edit role screen #153808

Merged
merged 7 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { EuiComboBox, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import _ from 'lodash';
import React, { Component } from 'react';

import { i18n } from '@kbn/i18n';

import type { Role } from '../../../../../../common/model';
import { isRoleReadOnly } from '../../../../../../common/model';

Expand Down Expand Up @@ -41,6 +43,10 @@ export class ClusterPrivileges extends Component<Props, {}> {
return (
<EuiFlexItem key={'clusterPrivs'}>
<EuiComboBox
aria-label={i18n.translate(
'xpack.security.management.editRole.clusterPrivilegeForm.clusterPrivilegesAriaLabel',
{ defaultMessage: 'Cluster privileges' }
)}
data-test-subj={'cluster-privileges-combobox'}
options={options}
selectedOptions={selectedOptions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,28 @@ export class ElasticsearchPrivileges extends Component<Props, {}> {
</p>
}
>
<EuiFormRow hasEmptyLabelSpace>
<EuiComboBox
placeholder={
this.props.editable
? i18n.translate(
'xpack.security.management.editRole.elasticSearchPrivileges.addUserTitle',
{ defaultMessage: 'Add a user…' }
)
: undefined
}
options={this.props.runAsUsers.map((username) => ({
id: username,
label: username,
isGroupLabelOption: false,
}))}
selectedOptions={this.props.role.elasticsearch.run_as.map((u) => ({ label: u }))}
onCreateOption={this.onCreateRunAsOption}
onChange={this.onRunAsUserChange}
isDisabled={!editable}
/>
</EuiFormRow>
<EuiComboBox
aria-label={i18n.translate(
'xpack.security.management.editRole.elasticSearchPrivileges.runAsPrivilegesAriaLabel',
{ defaultMessage: 'Run as privileges' }
)}
placeholder={
this.props.editable
? i18n.translate(
'xpack.security.management.editRole.elasticSearchPrivileges.addUserTitle',
{ defaultMessage: 'Add a user…' }
)
: undefined
}
options={this.props.runAsUsers.map((username) => ({
label: username,
isGroupLabelOption: false,
}))}
selectedOptions={this.props.role.elasticsearch.run_as.map((u) => ({ label: u }))}
onCreateOption={this.onCreateRunAsOption}
onChange={this.onRunAsUserChange}
isDisabled={!editable}
/>
</EuiDescribedFormGroup>

<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,16 @@ export class IndexPrivilegeForm extends Component<Props, State> {
) : undefined
}
>
<Fragment>
<EuiComboBox
data-test-subj={`fieldInput${this.props.formIndex}`}
options={this.state.flsOptions.map(toOption)}
selectedOptions={grant.map(toOption)}
onCreateOption={this.onCreateGrantedField}
onChange={this.onGrantedFieldsChange}
isDisabled={this.props.isRoleReadOnly}
async={true}
isLoading={this.state.isFieldListLoading}
/>
</Fragment>
<EuiComboBox
data-test-subj={`fieldInput${this.props.formIndex}`}
options={this.state.flsOptions.map(toOption)}
selectedOptions={grant.map(toOption)}
onCreateOption={this.onCreateGrantedField}
onChange={this.onGrantedFieldsChange}
isDisabled={this.props.isRoleReadOnly}
async={true}
isLoading={this.state.isFieldListLoading}
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand All @@ -266,18 +264,16 @@ export class IndexPrivilegeForm extends Component<Props, State> {
fullWidth={true}
className="indexPrivilegeForm__deniedFieldsRow"
>
<Fragment>
<EuiComboBox
data-test-subj={`deniedFieldInput${this.props.formIndex}`}
options={this.state.flsOptions.map(toOption)}
selectedOptions={except.map(toOption)}
onCreateOption={this.onCreateDeniedField}
onChange={this.onDeniedFieldsChange}
isDisabled={isRoleReadOnly}
async={true}
isLoading={this.state.isFieldListLoading}
/>
</Fragment>
<EuiComboBox
data-test-subj={`deniedFieldInput${this.props.formIndex}`}
options={this.state.flsOptions.map(toOption)}
selectedOptions={except.map(toOption)}
onCreateOption={this.onCreateDeniedField}
onChange={this.onDeniedFieldsChange}
isDisabled={isRoleReadOnly}
async={true}
isLoading={this.state.isFieldListLoading}
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
EuiSelectableOnChangeEvent,
EuiSelectableSearchableSearchProps,
} from '@elastic/eui/src/components/selectable/selectable';
import React, { Component, lazy, Suspense } from 'react';
import React, { Component, Fragment, lazy, Suspense } from 'react';

import type { ApplicationStart, Capabilities } from '@kbn/core/public';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -85,8 +85,11 @@ class SpacesMenuUI extends Component<Props> {
};

return (
<>
<Fragment>
<EuiSelectable
aria-label={i18n.translate('xpack.spaces.navControl.spacesMenu.spacesAriaLabel', {
kc13greiner marked this conversation as resolved.
Show resolved Hide resolved
defaultMessage: 'Spaces',
})}
id={this.props.id}
className={'spcMenu'}
title={i18n.translate('xpack.spaces.navControl.spacesMenu.changeCurrentSpaceTitle', {
Expand All @@ -105,19 +108,19 @@ class SpacesMenuUI extends Component<Props> {
}}
>
{(list, search) => (
<>
<Fragment>
kc13greiner marked this conversation as resolved.
Show resolved Hide resolved
<EuiPopoverTitle paddingSize="s">
{search ||
i18n.translate('xpack.spaces.navControl.spacesMenu.selectSpacesTitle', {
defaultMessage: 'Your spaces',
})}
</EuiPopoverTitle>
{list}
</>
</Fragment>
)}
</EuiSelectable>
<EuiPopoverFooter paddingSize="s">{this.renderManageButton()}</EuiPopoverFooter>
</>
</Fragment>
);
}

Expand Down