mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
Revert "docs(docs-infra): use Signals Forms focusBoundControl"
This reverts commit 79e6dfdef3.
This commit is contained in:
committed by
Jessica Janiuk
parent
d710ebee6d
commit
79273c18c0
@@ -54,6 +54,7 @@ export class SearchDialog {
|
||||
readonly onClose = output();
|
||||
readonly dialog = viewChild.required<ElementRef<HTMLDialogElement>>('searchDialog');
|
||||
readonly items = viewChildren(SearchItem);
|
||||
readonly textField = viewChild(TextField);
|
||||
|
||||
readonly history = inject(SearchHistory);
|
||||
private readonly search = inject(Search);
|
||||
@@ -97,7 +98,7 @@ export class SearchDialog {
|
||||
}
|
||||
// We want to select the pre-existing text on opening
|
||||
// In order to change the search input with minimal user interaction.
|
||||
this.searchForm().focusBoundControl();
|
||||
this.textField()?.input().nativeElement.select();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
inject,
|
||||
input,
|
||||
linkedSignal,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import {Select, SelectOption, TextField} from '@angular/docs';
|
||||
import {FormField, form} from '@angular/forms/signals';
|
||||
@@ -61,6 +62,7 @@ export default class ApiReferenceList {
|
||||
// services
|
||||
private readonly apiReferenceManager = inject(ApiReferenceManager);
|
||||
private readonly router = inject(Router);
|
||||
private readonly filterInput = viewChild.required(TextField);
|
||||
private readonly injector = inject(EnvironmentInjector);
|
||||
|
||||
// inputs
|
||||
@@ -135,12 +137,13 @@ export default class ApiReferenceList {
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const filterInput = this.form.query();
|
||||
const filterInput = this.filterInput();
|
||||
afterNextRender(
|
||||
{
|
||||
write: () => {
|
||||
// Why not improve this once https://github.com/orgs/angular/projects/60?pane=issue&itemId=143488813 is done
|
||||
if (matchMedia('(hover: hover) and (pointer:fine)').matches) {
|
||||
scheduleOnIdle(() => filterInput.focusBoundControl());
|
||||
scheduleOnIdle(() => filterInput.focus());
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user