fix(core): input not automatically focused (#10050)

Fix issue [AF-2161](https://linear.app/affine-design/issue/AF-2161).
This commit is contained in:
akumatus
2025-02-11 13:43:41 +00:00
parent 401ce70153
commit 9ca2133e34

View File

@@ -7,7 +7,7 @@ import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/utils';
import { SearchIcon } from '@blocksuite/icons/lit';
import type { DocMeta } from '@blocksuite/store';
import { css, html } from 'lit';
import { property, state } from 'lit/decorators.js';
import { property, query, state } from 'lit/decorators.js';
import type { DocSearchMenuConfig } from '../chat-config';
import type { ChatChip } from '../chat-context';
@@ -93,11 +93,20 @@ export class ChatPanelAddPopover extends SignalWatcher(
@property({ attribute: false })
accessor abortController!: AbortController;
@query('.search-input')
accessor searchInput!: HTMLInputElement;
override connectedCallback() {
super.connectedCallback();
this._updateDocGroup();
}
override firstUpdated() {
requestAnimationFrame(() => {
this.searchInput.focus();
});
}
override render() {
const items = Array.isArray(this._docGroup.items)
? this._docGroup.items