Skip to content
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

Keyboard Focus when changing Postcode #38

Closed
xdaDaveShaw opened this issue Jul 24, 2018 · 6 comments
Closed

Keyboard Focus when changing Postcode #38

xdaDaveShaw opened this issue Jul 24, 2018 · 6 comments

Comments

@xdaDaveShaw
Copy link
Contributor

When typing in a postcode the focus is always set to the end of the text box.

gif

This looks to be because changing the text goes through the update loop and sets the text to upper-case, which in turn updates the text moving the selection to the end.

I've had a look at fixing this by setting selectionStart and selectionEnd in the view, but I can't get it to work properly.

@xdaDaveShaw
Copy link
Contributor Author

I meant to say last night when I logged this... I'm more interested in how this might be fixed, than actually seeing it fixed.

Would the PostcodeChanged event updating the Postcode be removed and using plain old javascript or a CSS text transform, or is there a React / Fable / Elmish way to do it.

@xdaDaveShaw
Copy link
Contributor Author

Looks related to: elmish/react#12

@isaacabraham
Copy link
Member

Mmmm. Probably the way you would have to do it is manually figure out the index of which key had changed, and then on the way out set the index of the textbox in the view function. I'm not sure how to do that off the top of my head though! Happy to see what the other issue solution is :-)

@xdaDaveShaw
Copy link
Contributor Author

Looking at the comments on that linked Issue, it would be solved in the next version of Elmish React or by using withReactUnoptimized - I'm unable to test at the moment, but might have time later tonigh.

@xdaDaveShaw
Copy link
Contributor Author

Hmm, withReactUnoptimized doesn't seem to solve it. Maybe the newer Elmish React will when it is released

@isaacabraham
Copy link
Member

Fixed with latest PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants