miniature-lizard-24702
11/15/2022, 4:12 PMminiature-lizard-24702
11/15/2022, 4:17 PMsalmon-oil-67352
11/15/2022, 4:17 PMwhite-london-59674
11/15/2022, 4:33 PMbillions-furniture-78242
11/15/2022, 6:53 PMworried-eve-2556
11/15/2022, 6:54 PMgorgeous-airport-54386
11/15/2022, 6:58 PMmysterious-toddler-20573
11/15/2022, 7:01 PMgorgeous-airport-54386
11/15/2022, 7:06 PMmysterious-toddler-20573
11/15/2022, 7:20 PMmysterious-toddler-20573
11/15/2022, 7:20 PMmysterious-toddler-20573
11/15/2022, 7:20 PMmysterious-toddler-20573
11/15/2022, 7:20 PMgorgeous-airport-54386
11/15/2022, 7:20 PMmysterious-toddler-20573
11/15/2022, 7:20 PMgorgeous-airport-54386
11/15/2022, 7:21 PMmysterious-toddler-20573
11/15/2022, 7:21 PMmysterious-toddler-20573
11/15/2022, 7:21 PMgorgeous-airport-54386
11/15/2022, 7:21 PMmysterious-toddler-20573
11/15/2022, 7:21 PMmysterious-toddler-20573
11/15/2022, 7:21 PMwhite-motorcycle-95262
11/15/2022, 8:20 PMinput
field for a coupon/promotion code. That field has an hx-put
that targets the entire shopping cart (backend verifies if the coupon exists/is applicable and re-renders the cart if so, or renders an error around the input). The trigger is hx-trigger="keyup changed delay:500ms"
The issue is: if someone takes more than 500ms (or whatever the delay value is set to), then the input gets unfocused when the response loads. Even if I add a autofocus
attribute to the input in the response, it stays focused but the cursor moves to the start of the input field.
What's the best way to address this in a way that gives the optimal user experience?salmon-oil-67352
11/15/2022, 8:22 PMwhite-motorcycle-95262
11/15/2022, 8:24 PMsalmon-oil-67352
11/15/2022, 8:25 PMwhite-motorcycle-95262
11/15/2022, 8:28 PMon click from <a/> in me
transition .modal-backdrop's opacity to 0
remove (.modal-backdrop)
end
I'm sure you can do something similar in vanilla js if not using hyperscript.
EDIT: The important part was haivng that on the fragment that htmx put into the modal. I have a modal defined in my base.html template that has no contents, and I tell htmx to put request into it. So if I definded that on the modal, it wouldn't know of any tags..
Obviously you'll need to adapt it a little bit. My concern was links in the modal didn't remove the dark background.salmon-oil-67352
11/15/2022, 8:29 PMmysterious-toddler-20573
11/15/2022, 8:29 PMmysterious-toddler-20573
11/15/2022, 8:29 PMmysterious-toddler-20573
11/15/2022, 8:30 PM