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

Text field doesn't hide the error message when it becomes valid #543

Closed
denis-anisimov opened this issue Feb 20, 2018 · 8 comments
Closed
Labels
awaits another ticket Blocked by other issue bug Something isn't working Components flow

Comments

@denis-anisimov
Copy link

See the code below.

Binder<String> binder = new Binder<>();
        TextField field = new TextField();
        field.setValue("foo");
        binder.forField(field)
                .withValidator(text -> !text.equals("no"), "Error message")
                .bind(item -> item, (item, value) -> {
                });
        add(field);

Steps to reproduce:

  • Remove the current text field value and type "no" ( which is invalid value).
  • Check that text field became invalid and shows the error message.
  • Make the text field valid again.

Expected: no error message is shown (the field by the way became valid since there is no invalid attribute).
Reality: the error message is shown.

It happens because binder doesn't clear the error message when the HasValidation component component becomes valid.
This is consequence of vaadin/flow#3439.
There has been a discussion about this and it has been agreed that this behavior is correct.
But apparently it's not.
As I understand the bug is in the vaadin-text-field component since the behavior has been guaranteed on the elements side.
So this ticket is just to be able to track this on Flow side. Should be fixed on the vaadin-text-field side.

@denis-anisimov
Copy link
Author

The ticket for vaadin-text-field : https://github.com/vaadin/vaadin-text-field/issues/200

@denis-anisimov
Copy link
Author

It happens only for unthemed component apparently: web elements team states that error message hiding is implemented as a part of theme.
So it might be that this is kind of not a bug.

But we should be aware of this behavior at least.

@jouni
Copy link
Member

jouni commented Feb 20, 2018

I’m expecting the Elements team to fix this in the core styles (unthemed version) also, so that the error message is hidden.

@denis-anisimov
Copy link
Author

I think this can be closed here since it's confirmed issue in the vaadin-text-field web element (unthemed).

@Legioth
Copy link
Member

Legioth commented Mar 5, 2018

On the other hand, it might also be good to keep this ticket open so that anyone that cares about this issue will know in which version version of the Flow integration they should update to?

@denis-anisimov
Copy link
Author

Might be, yes.

@ghost
Copy link

ghost commented Feb 27, 2019

I'm using

<artifactId>vaadin-text-field-flow</artifactId>
<version>1.3.0</version>

in combination with flow 10.0.5. Without the additional text-field dependency i don't have this bug, but I want to use the new NumberField component. I checked the DOM and my fields have the proper invalid properties.
Since this is about Theme/CSS i'm wondering if there is a workaround?

@vaadin-bot vaadin-bot added awaits another ticket Blocked by other issue bug Something isn't working Components flow labels Oct 6, 2020
@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-text-field-flow Oct 6, 2020
@web-padawan
Copy link
Member

Closing in favor of #200 as both issues are now in the same repository. The unstyled components still behave the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaits another ticket Blocked by other issue bug Something isn't working Components flow
Projects
None yet
Development

No branches or pull requests

5 participants