Skip to content

Commit

Permalink
Fix primary actions not correctly becoming visible on keyboard focus
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Nov 17, 2023
1 parent 202261c commit bce2abb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelogs/upcoming/7373.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
**Accessibility**

- Fixed `EuiBasicTable` and `EuiInMemoryTable` actions not correctly reading out action descriptions to screen readers
- Fixed `EuiBasicTable` and `EuiInMemoryTable` primary actions not visibly appearing on keyboard focus
4 changes: 3 additions & 1 deletion src-docs/src/views/tables/actions/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default () => {
icon: 'editorLink',
color: 'primary',
type: 'icon',
enabled: ({ online }) => !!online,
href: ({ id }) => `${window.location.href}?id=${id}`,
target: '_self',
'data-test-subj': 'action-outboundlink',
Expand Down Expand Up @@ -218,7 +219,8 @@ export default () => {
{
name: 'Edit',
isPrimary: true,
available: ({ online }: { online: boolean }) => !online,
available: ({ online }) => !online,
enabled: ({ online }) => !!online,
description: 'Edit this user',
icon: 'pencil',
type: 'icon',
Expand Down
3 changes: 3 additions & 0 deletions src/components/basic_table/default_item_action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export const DefaultItemAction = <T,>({
href={href}
target={action.target}
data-test-subj={dataTestSubj}
// If action is disabled, the normal tooltip can't show - attempt to
// provide some amount of affordance with a browser title tooltip
title={!enabled ? tooltipContent : undefined}
/>
);
// actionContent (action.name) is a ReactNode and must be rendered
Expand Down
13 changes: 4 additions & 9 deletions src/components/table/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,15 @@
transition: opacity $euiAnimSpeedNormal $euiAnimSlightResistance, filter $euiAnimSpeedNormal $euiAnimSlightResistance;
}

.expandedItemActions__completelyHide,
.expandedItemActions__completelyHide:disabled,
.expandedItemActions__completelyHide:disabled:hover,
.expandedItemActions__completelyHide:disabled:focus,
.euiTableRow:hover & .expandedItemActions__completelyHide:disabled {
.expandedItemActions__completelyHide {
filter: grayscale(0%);
opacity: 0;
}
}

&:hover .euiTableCellContent--showOnHover .euiTableCellContent__hoverItem:not(:disabled) {
&,
&:hover,
&:focus {
&:hover .euiTableCellContent--showOnHover,
.euiTableCellContent--showOnHover:focus-within {
.euiTableCellContent__hoverItem {
opacity: 1;
filter: grayscale(0%);
}
Expand Down

0 comments on commit bce2abb

Please sign in to comment.