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

ui: add input as event for text form field #18563

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

hellobontempo
Copy link
Contributor

While smoke testing the pki key workflow, I noticed the model name wasn't updating as the text changed in the input field.

onchange={{this.onChangeWithEvent}}
onkeyup={{this.handleKeyUp}}
{{on "input" this.onChangeWithEvent}}
{{on "change" this.onChangeWithEvent}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

both of these other event listeners are redundant here, now that "input" has been added, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

From MDN:

The change event is fired for <input>, <select>, and <textarea> elements when the user modifies the element's value. Unlike the input event, the change event is not necessarily fired for each alteration to an element's value.

It looks like they are mostly interchangeable, and we should favor change events because historically the input event isn't always implemented to spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's what I read from the docs, but when it was just on change the model wasn't updating properly 🤔

Copy link
Collaborator

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@hellobontempo hellobontempo merged commit a83a201 into main Jan 4, 2023
@hellobontempo hellobontempo deleted the ui/update-form-field-input-event branch January 4, 2023 20:36
joshbrand pushed a commit that referenced this pull request Jan 11, 2023
* add input as event for form field

* fix event typo, lowercase u
AnPucel pushed a commit that referenced this pull request Jan 14, 2023
* add input as event for form field

* fix event typo, lowercase u
dhuckins pushed a commit that referenced this pull request Jan 19, 2023
* add input as event for form field

* fix event typo, lowercase u
dhuckins pushed a commit that referenced this pull request Jan 19, 2023
* add input as event for form field

* fix event typo, lowercase u
AnPucel pushed a commit that referenced this pull request Jan 25, 2023
* add input as event for form field

* fix event typo, lowercase u
AnPucel pushed a commit that referenced this pull request Feb 3, 2023
* add input as event for form field

* fix event typo, lowercase u
jayant07-yb pushed a commit to jayant07-yb/hashicorp-vault-integrations that referenced this pull request Mar 15, 2023
* add input as event for form field

* fix event typo, lowercase u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants