esc-blur-polyfill
v1.0.2
Published
HTMX extension to send extra parameter on blur event
Downloads
9
Readme
esc-blur-polyfill
This an extension for HTMX
To use it update your HTML template with
<script src="https://cdn.jsdelivr.net/npm/[email protected]/esc-blur-polyfill.js"></script>
Then update element that you wish it to take effect
<input
class="edit"
name="title"
hx-trigger="keyup[keyCode==13], blur"
hx-get={ fmt.Sprintf(`/update?id=%s`, strconv.FormatUint(action, 10)) }
hx-target="closest <li/>"
hx-swap="outerHTML"
hx-ext="esc-blur-polyfill"
autofocus
/>
What happen is specific event where ESC key is press will send query parameter &esc=true
and false
for non-ESC keys. The intention here is to have behavior blur works similar like in modern front-end frameworks where ESC key is excluded from blur
event.