Archived
Focus project path input on add dialog
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { LitElement, html } from "lit";
|
import { LitElement, html } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators.js";
|
import { customElement, property, query, state } from "lit/decorators.js";
|
||||||
import { api, type FileSuggestion } from "../api";
|
import { api, type FileSuggestion } from "../api";
|
||||||
import { css } from "lit";
|
import { css } from "lit";
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ export class ProjectDialog extends LitElement {
|
|||||||
@state() private suggestions: FileSuggestion[] = [];
|
@state() private suggestions: FileSuggestion[] = [];
|
||||||
@state() private selected = 0;
|
@state() private selected = 0;
|
||||||
@state() private loading = false;
|
@state() private loading = false;
|
||||||
|
@query("input") private pathInput?: HTMLInputElement;
|
||||||
|
|
||||||
private requestId = 0;
|
private requestId = 0;
|
||||||
|
|
||||||
@@ -20,6 +21,10 @@ export class ProjectDialog extends LitElement {
|
|||||||
void this.loadSuggestions();
|
void this.loadSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override firstUpdated(): void {
|
||||||
|
this.pathInput?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
private async loadSuggestions() {
|
private async loadSuggestions() {
|
||||||
const requestId = ++this.requestId;
|
const requestId = ++this.requestId;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user