fix: report every user caret move through TokenField onChange (#10766)
* fix: report every user caret move through TokenField onChange
setTokenFieldSelection marked the next selectionchange as programmatic even
when the selection was already in place and setBaseAndExtent was skipped. No
selectionchange followed to consume the flag, so the next user caret move was
dropped and value.selectedRange fell one move behind the DOM selection.
Only set the flag when the selection is actually changed.
Fixes #10764
Co-authored-by: Baradhan Madhavan <222307534+Baradhan-Madhu@users.noreply.github.com>
* test: use the TokenField caret onChange test from #10765
Covers tokens and both arrow directions, and checks the DOM selection and
the value passed to onChange after each key press.
Co-authored-by: Mariana Castro <marianacastrorc@gmail.com>
Co-authored-by: Baradhan Madhavan <222307534+Baradhan-Madhu@users.noreply.github.com>
* Revert "test: use the TokenField caret onChange test from #10765"
Its ArrowLeft step across a token fails in WebKit on CI, which is the
separate WebKit behavior noted in #10764. Restore the plain-text test, which
passed in all three engines.
This reverts commit fa35555e1d78fb475f69f80537bd519b76ca81be.
Co-authored-by: Baradhan Madhavan <222307534+Baradhan-Madhu@users.noreply.github.com>
---------
Co-authored-by: Baradhan Madhavan <222307534+Baradhan-Madhu@users.noreply.github.com>
Co-authored-by: Mariana Castro <marianacastrorc@gmail.com>