markInvalid and tab logic

edited March 24 in Technical questions

When the field is marked as invalid, the focus change logic does not work properly.
https://snippet.webix.com/3vbdrlts

How to reproduce:
1) Focus in login-field:
2) Type "123";
3) Press "tab".

https://imgur.com/a/FppDTIQ

Tagged:

Comments

  • edited April 14

    Hello @lBeJIuk,

    When the field is marked as invalid, the focus change logic does not work properly.

    I don't think this can be classified as a bug, since the onChange event in this case is triggered correctly - right after the input with the modified value has lost it focus. As the event gets triggered, a validation is performed. As you switch to the next input the focus gets lost because of the validation error, as is expected in this case.

  • @Dzmitry Hello. Thank you for answering.

    The loss of focus is not caused by a validation check, but by calling the markInvalid method.

    https://snippet.webix.com/jmy51bdh

    https://imgur.com/a/M3QG9xL

  • edited April 15

    The loss of focus is not caused by a validation check, but by calling the markInvalid method.

    Essentially, what I meant was: under normal circumstances the invalid message will be displayed most of the times the validation process fails (via invalidMessage) -> this means that a failed validation is indirectly causing this, i.e. https://snippet.webix.com/zz6q8n13 (but, of course, the markInvalid method is still being called in the private logic).

    But you are right, it is actually the markInvalid() method that is directly responsible for this behaviour. Still, I do not see how tab logic in particular relates to this, as the markInvalid() method on this own will always cause the input to lose its focus, hence the behaviour is within the expected norm.

  • @Dzmitry
    Yeah, you're right, there's no direct correlation. I just wanted to show you a case where I don't get the expected behavior.

    I don't really understand why markInvalid works like this. Why it is necessary to remove the input when calling the markInvalid function. That was my question.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion