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

Implement custom events #75

Merged
merged 7 commits into from
Mar 7, 2024
Merged

Implement custom events #75

merged 7 commits into from
Mar 7, 2024

Conversation

josefarias
Copy link
Owner

@josefarias josefarias commented Mar 7, 2024

This adds a hw-combobox:selection custom event, the details of which describe the status of the combobox.

This also introduces a new feature where if the combobox value is unjustifiably blank (i.e. no blank option is selected but the value is empty), then we clear the query. In line with #70, and also aligns well with the ergonomics of being able to expect an hw-combobox:selection event every time the hidden field value changes.

Finally, this also fixes a bug in the memoization of canonical_id, adds the missing .hw-combobox__input--invalid CSS class, and more completely adjusts validity in all comboboxes.

this.hiddenFieldTarget.value = null
this._setActiveDescendant("")

if (!option) this._dispatchSelectionEvent({ isNew: false })
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this placement a bit smelly. Good enough for now.

@josefarias josefarias merged commit dc9fb73 into main Mar 7, 2024
2 checks passed
@josefarias josefarias deleted the jose/custom-events branch March 7, 2024 15:25
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

Successfully merging this pull request may close these issues.

1 participant