fix: Add `bind:focused` to `HTMLAttributes` (#15122)

* Revert "fix: ensure untrack correctly retains the active reaction (#15065)"

This reverts commit 2ad519542d.

* feat: Add `bind:focused` to `HTMLAttributes`

* Revert "Revert "fix: ensure untrack correctly retains the active reaction (#15065)""

This reverts commit f4e98bf89f.

* changeset

* tests
pull/15129/head
Elliott Johnson 8 months ago committed by GitHub
parent 0e0f01ee1c
commit 3f8ce21f47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: Add `bind:focused` property to `HTMLAttributes` type

@ -839,6 +839,7 @@ export interface HTMLAttributes<T extends EventTarget> extends AriaAttributes, D
readonly 'bind:contentBoxSize'?: Array<ResizeObserverSize> | undefined | null; readonly 'bind:contentBoxSize'?: Array<ResizeObserverSize> | undefined | null;
readonly 'bind:borderBoxSize'?: Array<ResizeObserverSize> | undefined | null; readonly 'bind:borderBoxSize'?: Array<ResizeObserverSize> | undefined | null;
readonly 'bind:devicePixelContentBoxSize'?: Array<ResizeObserverSize> | undefined | null; readonly 'bind:devicePixelContentBoxSize'?: Array<ResizeObserverSize> | undefined | null;
readonly 'bind:focused'?: boolean | undefined | null;
// SvelteKit // SvelteKit
'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null; 'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;

@ -0,0 +1,8 @@
<script lang="ts">
let focused = $state(false);
</script>
<input bind:focused={focused} type="text" />
<textarea bind:focused={focused}></textarea>
<select bind:focused={focused}></select>
<div bind:focused={focused}></div>
Loading…
Cancel
Save