pageshow, bfcache, two-way binding of <input> #2529
iacore
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Making an
<input>
work with Solid is not easy. Especially when the browser sets the input fields from bfcache.Here's the simplest code I can think of.
How to test
A browser tab should now open.
What is happening
el.value
is set by the browser beforepageshow
event and afterel
is attached to the document.I feel like this behavior is necessary when writing a long form for someone to fill out. bfcache should cache the page even after the browser is restarted in same case.
https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent
I have no idea about the interaction between page transition and Solid lifecycle.
No support from libraries
After searching through some code on https://www.solidjs.com/ecosystem?search=input#primitive, no one supports
pageshow
.https://github.com/search?q=repo%3Apablo-abc%2Ffelte+pageshow&type=code
https://github.com/search?q=repo%3Afabian-hiller%2Fmodular-forms%20pageshow&type=code
https://github.com/search?q=repo%3Aniliadu%2Fsolid-js-form%20pageshow&type=code
https://github.com/search?q=repo%3Apureliani%2Fformix%20pageshow&type=code
https://github.com/search?q=repo%3Aniliadu%2Fsolid-js-form%20pageshow&type=code
https://github.com/search?q=repo%3Aodama626%2Fsolid-validation%20pageshow&type=code
What I want to see in Solid
The syntax to do this should be easy.
Some kind of proper two-way binding.
Be able to attach event handler to window, like in Svelte. This event should be delegated.
Beta Was this translation helpful? Give feedback.
All reactions