autofocus summary input when opening SummaryPathDisplay popover (#8052)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Guilhem
2026-02-23 13:48:34 +00:00
committed by GitHub
parent 0aa885db67
commit 0604600b8b
2 changed files with 9 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
let popoverOpen = $state(false)
let own = $state(false)
let onBehalfOfEmail = $state<string | undefined>(undefined)
let summaryInput: ReturnType<typeof TextInput> | undefined = $state()
let hasChanges = $derived(editSummary !== (summary ?? '') || (own && dirtyPath))
$effect(() => {
@@ -75,6 +76,10 @@
usePointerDownOutside
excludeSelectors=".drawer"
disableFocusTrap
openFocus={() => {
summaryInput?.focus()
return null
}}
bind:isOpen={popoverOpen}
>
{#snippet trigger()}
@@ -98,6 +103,7 @@
{#if onSaved}
<Label label="Summary">
<TextInput
bind:this={summaryInput}
inputProps={{
type: 'text',
placeholder: 'Short summary',
@@ -146,6 +152,7 @@
<label class="block text-primary">
<div class="pb-1 text-xs font-semibold text-emphasis">Summary</div>
<TextInput
bind:this={summaryInput}
inputProps={{
type: 'text',
placeholder: 'Short summary',

View File

@@ -37,6 +37,7 @@
export let disabled: boolean = false
export let documentationLink: string | undefined = undefined
export let disableFocusTrap: boolean = false
export let openFocus: string | HTMLElement | (() => HTMLElement | null) | null | undefined = undefined
export let escapeBehavior: EscapeBehaviorType = 'close'
export let enableFlyTransition: boolean = false
export let onKeyDown: (e: KeyboardEvent) => void = () => {}
@@ -75,6 +76,7 @@
portal: dynamicPortal,
disableFocusTrap,
escapeBehavior,
openFocus,
onOpenChange: ({ curr, next }) => {
if (curr != next) {
dispatch('openChange', next)