Skip to content

Commit 5d728d2

Browse files
committed
fixup! docs: create aria autocomplete docs
1 parent 4cc390c commit 5d728d2

File tree

4 files changed

+4
-36
lines changed

4 files changed

+4
-36
lines changed

src/components-examples/aria/autocomplete/autocomplete-auto-select/autocomplete-auto-select-example.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,9 @@ export class AutocompleteAutoSelectExample {
6363

6464
constructor() {
6565
// Scrolls to the active item when the active option changes.
66-
// The slight delay here is to ensure animations are done before scrolling.
6766
afterRenderEffect(() => {
6867
const option = this.options().find(opt => opt.active());
69-
setTimeout(() => option?.element.scrollIntoView({block: 'nearest'}), 50);
70-
});
71-
72-
// Resets the listbox scroll position when the combobox is closed.
73-
afterRenderEffect(() => {
74-
if (!this.combobox()?.expanded()) {
75-
setTimeout(() => this.listbox()?.element.scrollTo(0, 0), 150);
76-
}
68+
option?.element.scrollIntoView({block: 'nearest'});
7769
});
7870
}
7971
}

src/components-examples/aria/autocomplete/autocomplete-disabled/autocomplete-disabled-example.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,9 @@ export class AutocompleteDisabledExample {
6363

6464
constructor() {
6565
// Scrolls to the active item when the active option changes.
66-
// The slight delay here is to ensure animations are done before scrolling.
6766
afterRenderEffect(() => {
6867
const option = this.options().find(opt => opt.active());
69-
setTimeout(() => option?.element.scrollIntoView({block: 'nearest'}), 50);
70-
});
71-
72-
// Resets the listbox scroll position when the combobox is closed.
73-
afterRenderEffect(() => {
74-
if (!this.combobox()?.expanded()) {
75-
setTimeout(() => this.listbox()?.element.scrollTo(0, 0), 150);
76-
}
68+
option?.element.scrollIntoView({block: 'nearest'});
7769
});
7870
}
7971
}

src/components-examples/aria/autocomplete/autocomplete-highlight/autocomplete-highlight-example.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,9 @@ export class AutocompleteHighlightExample {
6363

6464
constructor() {
6565
// Scrolls to the active item when the active option changes.
66-
// The slight delay here is to ensure animations are done before scrolling.
6766
afterRenderEffect(() => {
6867
const option = this.options().find(opt => opt.active());
69-
setTimeout(() => option?.element.scrollIntoView({block: 'nearest'}), 50);
70-
});
71-
72-
// Resets the listbox scroll position when the combobox is closed.
73-
afterRenderEffect(() => {
74-
if (!this.combobox()?.expanded()) {
75-
setTimeout(() => this.listbox()?.element.scrollTo(0, 0), 150);
76-
}
68+
option?.element.scrollIntoView({block: 'nearest'});
7769
});
7870
}
7971
}

src/components-examples/aria/autocomplete/autocomplete-manual/autocomplete-manual-example.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,9 @@ export class AutocompleteManualExample {
6363

6464
constructor() {
6565
// Scrolls to the active item when the active option changes.
66-
// The slight delay here is to ensure animations are done before scrolling.
6766
afterRenderEffect(() => {
6867
const option = this.options().find(opt => opt.active());
69-
setTimeout(() => option?.element.scrollIntoView({block: 'nearest'}), 50);
70-
});
71-
72-
// Resets the listbox scroll position when the combobox is closed.
73-
afterRenderEffect(() => {
74-
if (!this.combobox()?.expanded()) {
75-
setTimeout(() => this.listbox()?.element.scrollTo(0, 0), 150);
76-
}
68+
option?.element.scrollIntoView({block: 'nearest'});
7769
});
7870
}
7971
}

0 commit comments

Comments
 (0)