Skip to content

Commit

Permalink
Merge pull request #2825 from kush-savani/outline-on-sortable-headers
Browse files Browse the repository at this point in the history
fix(data-table): focus outline on selected sortable table headers
  • Loading branch information
zvonimirfras authored Apr 11, 2024
2 parents 27e4e6c + e6d68cc commit fa59676
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ export class Table implements AfterViewInit, OnDestroy {

static focus(element: HTMLElement) {
const focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);
if (element.firstElementChild && element.firstElementChild.classList.contains("cds--table-sort") && focusElementList.length > 1) {
focusElementList[1].focus();
} else if (focusElementList.length > 0) {
if (
(element.firstElementChild?.classList.contains("cds--table-sort") && focusElementList.length > 1) ||
focusElementList.length > 0
) {
focusElementList[0].focus();
} else {
element.focus();
Expand Down

0 comments on commit fa59676

Please sign in to comment.