-
Notifications
You must be signed in to change notification settings - Fork 83
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
fix: ensure user input is reverted before validation on blur #6163
fix: ensure user input is reverted before validation on blur #6163
Conversation
* @protected | ||
* @override | ||
*/ | ||
_setFocused(focused) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: By moving the overlay closing logic to _setFocused
, we ensure the correct sequence: the overlay closes first, and then the validation occurs.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -87,6 +88,14 @@ describe('validation', () => { | |||
expect(comboBox.validate()).to.be.true; | |||
expect(comboBox.invalid).to.be.false; | |||
}); | |||
|
|||
it('should be invalid after user input is reverted on blur', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: The test that covers the issue.
@@ -1029,7 +1029,7 @@ describe('lazy loading', () => { | |||
let returnedItems; | |||
|
|||
const bluringDataProvider = (params, callback) => { | |||
comboBox.blur(); | |||
comboBox.inputElement.blur(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: The combo-box-light doesn't delegate blur()
calls to the input element.
Description
Fixes an issue where
<combo-box required>
didn't get invalidated after entering an invalid value and subsequently clicking outside. The issue occurred becausecombo-box
triggered validation before reverting user input and from the perspective of the HTML constraint validation, it appeared as ifcombo-box
had a value.Along the way, the PR fixes
combo-box-light
not getting validated on blur and also adds thefocused
attribute for it.Fixes #6164, vaadin/flow-components#5712
Type of change