Re:Vanilla-todo: A case study on viable techniques for vanil...
by ericmcer on Tuesday October 27, 2020 @03:28PM
(#24910884)
it is possible to track and set cursor location after updating innerHTML... it is definitely no longer simple and clean though haha.
https://codesandbox.io/s/zealous-vaughan-qd3gg?file=/src/ind...
Re:Vanilla-todo: A case study on viable techniques for vanil...
by eliseumds on Tuesday October 27, 2020 @04:05PM
(#24911229)
Your answered yourself there. It's not only about input focus, it could be anything really, like loading state, form values, progress indicator, etc. People will be basically building yet another framework at the end. React is not the only solution, there are plenty of lighter alternatives. OP's solution is just very type-unsafe.
Re:Vanilla-todo: A case study on viable techniques for vanil...
by SahAssar on Wednesday October 28, 2020 @03:32AM
(#24916190)
IIRC it will also lead to weird behavior for people using screenreaders, they usually restart saying whatever they where reading when the element was replaced even if the contents are the same.
And that's why reconciliation algorithms became so popular. You can't be serious when you say that losing input focus and text selection have never been relevant to you. Basically, dealing with the internal state of components down the tree becomes a nightmare.