loosing focus from username field in login makes user unable to login
Closed this issue · 6 comments
If you click somewhere in the login window, focus is lost from the input field and then you cannot get focus back to the username and successfully login
I reproduced that, it might be related so I post this remark in there:
Why is there a reference to the ref password
in the LoginView react component... ? I can't think of any place where there is an actual password ref, isn't it a mistake for username ? it seems to be undefined all the time.
componentDidUpdate() {
if(this.refs.password) this.refs.password.focus();
}
// LoginView component l.63-65
No matter what, the component is not updated on a click to the background of the login view (it's the same component) and yet the focus is lost... I used an event on the LoginView wrapper to make sure we always keep the focus, it works so far. I'll submit the PR if that's an acceptable solution @haadcode :
onLoginViewClick(e) {
if(this.refs.username) this.refs.username.focus();
}
@theobat the password field is a remnant of old (obsolete) code. You can safely remove all references to passwords. There might be another ref/field called network in there, which you can safely remove too.
I'm fine with the solution above, for now, but it might become a problem as you implement the config/option button (user needs to be able to press the button). Perhaps a long-term solution would be to attach a keydown
listener to the LoginView, check if it's enter and call login if it is. This way it's not tied to the form/input field but allows to login even if the focus was lost from the input field, as well as making sure the user can click on the "config" button (once it's there).
What do you think?
Perhaps a long-term solution would be to attach a keydown listener to the LoginView, check if it's enter and call login if it is. This way it's not tied to the form/input field but allows to login even if the focus was lost from the input field, as well as making sure the user can click on the "config" button (once it's there).
Yes seems like a better idea (I think clicking on the input area should give the focus back though)
This is fixed (changed z-index on input field), but the "planets" in the login animation have disappeared.
I can fix the "planets" quickly.
I'm closing this, it has been fixed