New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input looses internal focus state on redraw #1593

Closed
barneycarroll opened this Issue Feb 6, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@barneycarroll
Copy link
Member

barneycarroll commented Feb 6, 2017

In this bin, a regular event triggers redraws. The caret / selection within the input will reset on each such redraw. I haven't been able to reproduce this bug consistently.

Inputs can reliably be safeguarded by specifying onbeforeupdate : ( now, then ) => now.attrs.value != then.attrs.value, but this comes at the cost of not rebinding other attributes which may have changed, such as input handlers.

@daniel-j

This comment has been minimized.

Copy link

daniel-j commented Feb 6, 2017

I had this issue too. I solved this by setting the value to the input as string, just append an empty string or something and it will remember cursor position/selection.

@barneycarroll

This comment has been minimized.

Copy link
Member

barneycarroll commented Feb 6, 2017

Aha! How strange. Surely Mithril should compare the raw attributes?

@pygy

This comment has been minimized.

Copy link
Member

pygy commented Feb 6, 2017

Firefox appears to be immune though, but it happens in both Chrome and Safari 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment