Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea committed Jul 17, 2024
1 parent 6058236 commit 2f209fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 0 additions & 2 deletions projects/core/directives/dropdown/dropdown-open.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ export class TuiDropdownOpen implements OnChanges {

private focusDropdown(previous: boolean): void {
if (!this.dropdown) {
this.update(true);

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ test.describe('DataList', () => {
await example.locator('button').click();
await documentationPagePO.prepareBeforeScreenshot();
await page.keyboard.down('ArrowDown');
await page.keyboard.down('ArrowDown');
await page.waitForTimeout(100);
await page.keyboard.down('Enter');
await page.waitForTimeout(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,10 @@ export class TuiDataListDropdownManager implements AfterViewInit {
}

private tryToFocus(index: number): void {
const content = this.dropdowns.get(index)?.dropdownBoxRef?.location.nativeElement;
const root = this.dropdowns.get(index)?.dropdownBoxRef?.location.nativeElement;

if (!content) {
return;
}

// First item is focus trap
const focusTrap = tuiGetClosestFocusable({initial: content, root: content});
const item = tuiGetClosestFocusable({
initial: focusTrap || content,
root: content,
});

if (item) {
item.focus();
if (root) {
tuiGetClosestFocusable({initial: root, root})?.focus();
}
}
}

0 comments on commit 2f209fc

Please sign in to comment.