Skip to content

Commit

Permalink
autofocus title field on create note
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Apr 22, 2024
1 parent 5125cc7 commit a5ec27f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ui/src/notebooks-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class NotebooksApp extends LitElement {
@query("#create-title")
_createTitle!: SlInput


@state()
disabled: boolean = true

Expand Down Expand Up @@ -463,9 +462,15 @@ export class NotebooksApp extends LitElement {
>
${msg("Create Note")}
</sl-button>
<sl-dialog .label=${msg("Create Note")} id="new-note-dialog">
<sl-dialog .label=${msg("Create Note")} id="new-note-dialog"
@sl-initial-focus=${(e: { preventDefault: () => void }) => {
e.preventDefault();
const title = this.shadowRoot?.getElementById("title") as SlInput
title.focus()
}}
>
<form ${onSubmit((f) => this.createNote(f.title))} id="note-form">
<sl-input name="title" .label=${msg("Title")} required></sl-input>
<sl-input id="title" name="title" .label=${msg("Title")} required></sl-input>
</form>
<sl-button slot="footer" @click=${() => this._newNoteDialog.hide()}>
Expand Down

0 comments on commit a5ec27f

Please sign in to comment.