Skip to content

Commit 3f8ce21

Browse files
fix: Add bind:focused to HTMLAttributes (#15122)
* Revert "fix: ensure untrack correctly retains the active reaction (#15065)" This reverts commit 2ad5195. * feat: Add `bind:focused` to `HTMLAttributes` * Revert "Revert "fix: ensure untrack correctly retains the active reaction (#15065)"" This reverts commit f4e98bf. * changeset * tests
1 parent 0e0f01e commit 3f8ce21

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.changeset/eleven-scissors-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: Add `bind:focused` property to `HTMLAttributes` type

packages/svelte/elements.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ export interface HTMLAttributes<T extends EventTarget> extends AriaAttributes, D
839839
readonly 'bind:contentBoxSize'?: Array<ResizeObserverSize> | undefined | null;
840840
readonly 'bind:borderBoxSize'?: Array<ResizeObserverSize> | undefined | null;
841841
readonly 'bind:devicePixelContentBoxSize'?: Array<ResizeObserverSize> | undefined | null;
842+
readonly 'bind:focused'?: boolean | undefined | null;
842843

843844
// SvelteKit
844845
'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script lang="ts">
2+
let focused = $state(false);
3+
</script>
4+
5+
<input bind:focused={focused} type="text" />
6+
<textarea bind:focused={focused}></textarea>
7+
<select bind:focused={focused}></select>
8+
<div bind:focused={focused}></div>

0 commit comments

Comments
 (0)