fix: use correct Datastar keydown event syntax
All checks were successful
CI / Deploy / test (push) Successful in 15s
CI / Deploy / lint (push) Successful in 25s
CI / Deploy / deploy (push) Successful in 34s

Replace invalid .key_enter and .enter modifiers with evt.key === 'Enter'
guard in the expression, per Datastar docs. Also fix __stop and __throttle
modifier syntax to use double underscores.
This commit is contained in:
Ryan Hamamura
2026-03-02 23:05:11 -10:00
parent 235e4afbe3
commit 64b5d384ed
6 changed files with 10 additions and 11 deletions

View File

@@ -42,8 +42,7 @@ templ Chat(messages []chat.Message, cfg Config) {
placeholder="Chat..."
autocomplete="off"
data-bind="chatMsg"
data-on:keydown.stop=""
data-on:keydown.key_enter={ datastar.PostSSE("%s", cfg.PostURL) }
data-on:keydown__stop={ "evt.key === 'Enter' && " + datastar.PostSSE("%s", cfg.PostURL) }
/>
} else {
<input
@@ -51,7 +50,7 @@ templ Chat(messages []chat.Message, cfg Config) {
placeholder="Chat..."
autocomplete="off"
data-bind="chatMsg"
data-on:keydown.enter={ datastar.PostSSE("%s", cfg.PostURL) }
data-on:keydown={ "evt.key === 'Enter' && " + datastar.PostSSE("%s", cfg.PostURL) }
/>
}
<button