Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiFormRow,
EuiIcon,
EuiSelect,
EuiToolTip,
} from '@elastic/eui';
import type { ChangeEvent } from 'react';
import React, { Component } from 'react';
Expand Down Expand Up @@ -156,21 +157,31 @@ export class FieldRuleEditor extends Component<Props, {}> {
<EuiFlexItem grow={false}>
<EuiFormRow hasEmptyLabelSpace={true}>
{this.props.readOnly === false && renderAddValueButton ? (
<EuiButtonIcon
iconSize="s"
iconType="plusCircle"
onClick={this.onAddAlternateValue}
color="primary"
data-test-subj="addAlternateValueButton"
aria-label={i18n.translate(
<EuiToolTip
content={i18n.translate(
'xpack.security.management.editRoleMapping.fieldRuleEditor.addAlternateValueButton',
{
defaultMessage: 'Add alternate value',
}
)}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
iconSize="s"
iconType="plusCircle"
onClick={this.onAddAlternateValue}
color="primary"
data-test-subj="addAlternateValueButton"
aria-label={i18n.translate(
'xpack.security.management.editRoleMapping.fieldRuleEditor.addAlternateValueButton',
{
defaultMessage: 'Add alternate value',
}
)}
/>
</EuiToolTip>
) : (
<EuiIcon size="s" type="empty" />
<EuiIcon size="s" type="empty" aria-hidden={true} />
)}
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -182,21 +193,31 @@ export class FieldRuleEditor extends Component<Props, {}> {
<EuiFlexItem grow={1}>
<EuiFormRow hasEmptyLabelSpace={true}>
{this.props.readOnly === false ? (
<EuiButtonIcon
iconType="trash"
color="danger"
iconSize="s"
data-test-subj={`fieldRuleEditorDeleteValue fieldRuleEditorDeleteValue-${valueIndex}`}
aria-label={i18n.translate(
<EuiToolTip
content={i18n.translate(
'xpack.security.management.editRoleMapping.fieldRuleEditor.deleteValueLabel',
{
defaultMessage: 'Delete value',
}
)}
onClick={() => this.onRemoveAlternateValue(valueIndex)}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
iconType="trash"
color="danger"
iconSize="s"
data-test-subj={`fieldRuleEditorDeleteValue fieldRuleEditorDeleteValue-${valueIndex}`}
aria-label={i18n.translate(
'xpack.security.management.editRoleMapping.fieldRuleEditor.deleteValueLabel',
{
defaultMessage: 'Delete value',
}
)}
onClick={() => this.onRemoveAlternateValue(valueIndex)}
/>
</EuiToolTip>
) : (
<EuiIcon size="s" type="empty" />
<EuiIcon size="s" type="empty" aria-hidden={true} />
)}
</EuiFormRow>
</EuiFlexItem>
Expand Down

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 @@ -16,6 +16,7 @@ import {
EuiPanel,
EuiSpacer,
EuiSwitch,
EuiToolTip,
} from '@elastic/eui';
import { css } from '@emotion/react';
import _ from 'lodash';
Expand Down Expand Up @@ -104,8 +105,8 @@ export class IndexPrivilegeForm extends Component<Props, State> {
</EuiFlexItem>
{!this.props.isRoleReadOnly && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
aria-label={
<EuiToolTip
content={
this.props.indexType === 'remote_indices'
? i18n.translate(
'xpack.security.management.editRole.indexPrivilegeForm.deleteRemoteIndexPrivilegeAriaLabel',
Expand All @@ -116,10 +117,25 @@ export class IndexPrivilegeForm extends Component<Props, State> {
{ defaultMessage: 'Delete index privilege' }
)
}
color={'danger'}
onClick={this.props.onDelete}
iconType={'trash'}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
aria-label={
this.props.indexType === 'remote_indices'
? i18n.translate(
'xpack.security.management.editRole.indexPrivilegeForm.deleteRemoteIndexPrivilegeAriaLabel',
{ defaultMessage: 'Delete remote index privilege' }
)
: i18n.translate(
'xpack.security.management.editRole.indexPrivilegeForm.deleteIndexPrivilegeAriaLabel',
{ defaultMessage: 'Delete index privilege' }
)
}
color={'danger'}
onClick={this.props.onDelete}
iconType={'trash'}
/>
</EuiToolTip>
</EuiFlexItem>
)}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
EuiFormRow,
EuiPanel,
EuiSpacer,
EuiToolTip,
} from '@elastic/eui';
import { css } from '@emotion/react';
import React, { Fragment, useCallback } from 'react';
Expand Down Expand Up @@ -165,16 +166,24 @@ export const RemoteClusterPrivilegesForm: React.FunctionComponent<Props> = ({
</EuiFlexItem>
{!isRoleReadOnly && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
aria-label={i18n.translate(
<EuiToolTip
content={i18n.translate(
'xpack.security.management.editRole.remoteClusterPrivilegeForm.deleteRemoteClusterPrivilegeAriaLabel',
{ defaultMessage: 'Delete remote cluster privilege' }
)}
color="danger"
onClick={onDelete}
iconType="trash"
data-test-subj={`deleteRemoteClusterPrivilegesButton${formIndex}`}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
aria-label={i18n.translate(
'xpack.security.management.editRole.remoteClusterPrivilegeForm.deleteRemoteClusterPrivilegeAriaLabel',
{ defaultMessage: 'Delete remote cluster privilege' }
)}
color="danger"
onClick={onDelete}
iconType="trash"
data-test-subj={`deleteRemoteClusterPrivilegesButton${formIndex}`}
/>
</EuiToolTip>
</EuiFlexItem>
)}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiInMemoryTable,
EuiSpacer,
EuiTitle,
EuiToolTip,
} from '@elastic/eui';
import React, { Fragment, useMemo, useState } from 'react';

Expand Down Expand Up @@ -126,12 +127,19 @@ export const PrivilegeSummaryTable = (props: PrivilegeSummaryTableProps) => {
return null;
}
return (
<EuiButtonIcon
onClick={() => toggleExpandedFeature(featureId)}
data-test-subj={`expandPrivilegeSummaryRow`}
aria-label={expandedFeatures.includes(featureId) ? 'Collapse' : 'Expand'}
iconType={expandedFeatures.includes(featureId) ? 'chevronSingleUp' : 'chevronSingleDown'}
/>
<EuiToolTip
content={expandedFeatures.includes(featureId) ? 'Collapse' : 'Expand'}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems unnecessary to add the additional tooltip text here given the style of the button and the inclusion of aria-label, but I am not opposed to it either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip is for sighted users to understand what this button does. aria-label allows screen readers to announce the button appropriately.

Our recommendation as EUI team: always wrap EuiButtonIcon with EuiToolTip and always pass aria-label to it.

disableScreenReaderOutput
>
<EuiButtonIcon
onClick={() => toggleExpandedFeature(featureId)}
data-test-subj={`expandPrivilegeSummaryRow`}
aria-label={expandedFeatures.includes(featureId) ? 'Collapse' : 'Expand'}
iconType={
expandedFeatures.includes(featureId) ? 'chevronSingleUp' : 'chevronSingleDown'
}
/>
</EuiToolTip>
);
},
};
Expand Down Expand Up @@ -180,7 +188,7 @@ export const PrivilegeSummaryTable = (props: PrivilegeSummaryTableProps) => {
/>
);
} else {
iconTip = <EuiIcon size="s" type="empty" />;
iconTip = <EuiIcon size="s" type="empty" aria-hidden={true} />;
}
return (
<span
Expand Down Expand Up @@ -229,7 +237,7 @@ export const PrivilegeSummaryTable = (props: PrivilegeSummaryTableProps) => {
>
{category.euiIconType ? (
<EuiFlexItem grow={false}>
<EuiIcon size="m" type={category.euiIconType} />
<EuiIcon size="m" type={category.euiIconType} aria-hidden={true} />
</EuiFlexItem>
) : null}
<EuiFlexItem grow={1}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
EuiIcon,
EuiIconTip,
EuiInMemoryTable,
EuiToolTip,
} from '@elastic/eui';
import React, { Component } from 'react';

Expand Down Expand Up @@ -187,7 +188,7 @@ export class PrivilegeSpaceTable extends Component<Props, State> {
? '*'
: basePrivilege;

let icon = <EuiIcon type="empty" size="s" />;
let icon = <EuiIcon type="empty" size="s" aria-hidden={true} />;
if (privilegeCalculator.hasSupersededInheritedPrivileges(record.privilegeIndex)) {
icon = (
<span data-test-subj="spaceTablePrivilegeSupersededWarning">
Expand Down Expand Up @@ -224,38 +225,60 @@ export class PrivilegeSpaceTable extends Component<Props, State> {
{
render: (record: TableRow) => {
return (
<EuiButtonIcon
aria-label={i18n.translate(
<EuiToolTip
content={i18n.translate(
'xpack.security.management.editRole.spacePrivilegeTable.editPrivilegesLabel',
{
defaultMessage: `Edit privileges for the following spaces: {spaceNames}.`,
values: { spaceNames: record.spaces.map((s) => s.name).join(', ') },
}
)}
color={'primary'}
iconType={'pencil'}
onClick={() => this.props.onEdit(record.privilegeIndex)}
data-test-subj={`privilegeEditAction-${record.privilegeIndex}`}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
aria-label={i18n.translate(
'xpack.security.management.editRole.spacePrivilegeTable.editPrivilegesLabel',
{
defaultMessage: `Edit privileges for the following spaces: {spaceNames}.`,
values: { spaceNames: record.spaces.map((s) => s.name).join(', ') },
}
)}
color={'primary'}
iconType={'pencil'}
onClick={() => this.props.onEdit(record.privilegeIndex)}
data-test-subj={`privilegeEditAction-${record.privilegeIndex}`}
/>
</EuiToolTip>
);
},
},
{
render: (record: TableRow) => {
return (
<EuiButtonIcon
aria-label={i18n.translate(
<EuiToolTip
content={i18n.translate(
'xpack.security.management.editRole.spacePrivilegeTable.deletePrivilegesLabel',
{
defaultMessage: `Delete privileges for the following spaces: {spaceNames}.`,
values: { spaceNames: record.spaces.map((s) => s.name).join(', ') },
}
)}
color={'danger'}
iconType={'trash'}
onClick={() => this.onDeleteSpacePrivilege(record)}
data-test-subj={`privilegeDeleteAction-${record.privilegeIndex}`}
/>
disableScreenReaderOutput
>
<EuiButtonIcon
aria-label={i18n.translate(
'xpack.security.management.editRole.spacePrivilegeTable.deletePrivilegesLabel',
{
defaultMessage: `Delete privileges for the following spaces: {spaceNames}.`,
values: { spaceNames: record.spaces.map((s) => s.name).join(', ') },
}
)}
color={'danger'}
iconType={'trash'}
onClick={() => this.onDeleteSpacePrivilege(record)}
data-test-subj={`privilegeDeleteAction-${record.privilegeIndex}`}
/>
</EuiToolTip>
);
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
EuiSuperSelect,
EuiSwitch,
EuiText,
EuiTextTruncate,
useEuiTheme,
} from '@elastic/eui';
import { css } from '@emotion/react';
Expand Down Expand Up @@ -172,9 +173,7 @@ export const SpaceCopyResultDetails = (props: Props) => {
`}
>
<EuiText size="s">
<p className="eui-textTruncate" title={name}>
{name}
</p>
<EuiTextTruncate text={name} />
</EuiText>
</EuiFlexItem>
{switchProps.show && (
Expand Down
Loading
Loading