Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -41,6 +41,7 @@ const TableCheckbox = forwardRef(
disabled={isDisabled}
id={checkboxId}
name={name}
tabIndex={0}
type="checkbox"
{...props}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/FocusTrap/useFocusTrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const useFocusTrap = ({
event.preventDefault();
lastElement.focus();
}
return;
}

// Tab: going forwards
Expand Down
5 changes: 5 additions & 0 deletions src/components/_internal/BaseTable/BaseTable.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ export const StyledBaseTable = styled.table`
display: block;
}
}

&:focus-visible + .ds-table-checkbox-mark {
outline: 3px solid var(--sscds-focus-indicator-color);
outline-offset: 1px;
}
}

.ds-table-checkbox-mark {
Expand Down
16 changes: 16 additions & 0 deletions src/components/_internal/BaseTable/Head/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const StyledTh = styled.th<{ sticky?: string }>`

${makeStickyColumn};

&[data-focus-visible='true']:focus-visible {
outline: 3px solid var(--sscds-focus-indicator-color);
outline-offset: -3px;
box-shadow: none;
}

${({ sticky }) =>
sticky === 'left' &&
css`
Expand Down Expand Up @@ -50,6 +56,16 @@ function Head<D extends Record<string, unknown>>({
...column.getSortByToggleProps({
...column.getSortByToggleProps(),
title: column.canSort ? `Sort ${column.Header}` : undefined,
...(column.canSort && {
tabIndex: 0,
'data-focus-visible': true,
onKeyDown: (event: React.KeyboardEvent) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
column.toggleSortBy();
}
},
}),
}),
...shrinkIfSticky(column.sticky),
});
Expand Down
Loading