Skip to content

Commit c559bf2

Browse files
authored
Merge pull request #2220 from kush-savani/issue2218
fix(table): set focus on sort table header button
2 parents 43686e2 + ae667e5 commit c559bf2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/table/table.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,7 @@ export class Table implements AfterViewInit, OnDestroy {
274274

275275
static setTabIndex(element: HTMLElement, index: -1 | 0) {
276276
const focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);
277-
if (element.firstElementChild && element.firstElementChild.classList.contains("bx--table-sort") && focusElementList.length > 1) {
278-
focusElementList[1].tabIndex = index;
279-
} else if (focusElementList.length > 0) {
277+
if (element.firstElementChild && element.firstElementChild.classList.contains("bx--table-sort") && focusElementList.length > 0) {
280278
focusElementList[0].tabIndex = index;
281279
} else {
282280
element.tabIndex = index;
@@ -285,9 +283,7 @@ export class Table implements AfterViewInit, OnDestroy {
285283

286284
static focus(element: HTMLElement) {
287285
const focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);
288-
if (element.firstElementChild && element.firstElementChild.classList.contains("bx--table-sort") && focusElementList.length > 1) {
289-
focusElementList[1].focus();
290-
} else if (focusElementList.length > 0) {
286+
if (element.firstElementChild && element.firstElementChild.classList.contains("bx--table-sort") && focusElementList.length > 0) {
291287
focusElementList[0].focus();
292288
} else {
293289
element.focus();

0 commit comments

Comments
 (0)