Caret thrown to end, when typing inside fractal in controlled input
Closed this issue · 5 comments
Describe the bug
When typing on either side of a fractal value, it allows typing one character and then caret is thrown to the end of the value. Happens only with controlled inputs
To Reproduce
Steps to reproduce the behavior:
- Go to https://shaman123.github.io/react-math-view/
- Focus on any of the controlled input examples
- Type shift+/ to convert to fractal
- Type any value
Expected behavior
Caret stays within the focused fractal side
Desktop (please complete the following information):
- OS: macOS Big Sur 11.5.2
- Browser Chrome
- Version 93.0.4577.82
I thought this was resolved.
I opened a related issue that was resolved. Caret was thrown when using setOptions
. As you can see from the source code it seems it does that now when using setValue
.
Perhaps try opening a new issue in mathlive after testing if downgrading mathlive to <=0.59 solves the problem.
I'll check some stuff as well
I'll release a version soon
Thanks
Gave it a closer inspection.
It seems that the mathfield resets caret position when value is changed imperatively (using setValue
) which is the case for controlled math view.
Workaround:
Store caret position onContentWillChange
and set it onContentDidChange
.
v1.3.2