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

va-statment-of-truth: make event payloads easier to use #1147

Merged
merged 6 commits into from
May 15, 2024

Conversation

it-harrison
Copy link
Contributor

@it-harrison it-harrison commented May 14, 2024

Chromatic

https://2783-va-statement-truth-bug--65a6e2ed2314f7b8f98609d8.chromatic.com


Description

This PR addresses a bug in which the events payloads for the vaInputChange and vaCheckBoxChange were difficult or impossible to make use of in an event handler. Now the payloads are at the top level of the event objects.

Closes 2783

QA Checklist

  • Component maintains 1:1 parity with design mocks
  • Text is consistent with what's been provided in the mocks
  • Component behaves as expected across breakpoints
  • Accessibility expert has signed off on code changes (if applicable. If not applicable provide reason why)
  • Designer has signed off on changes (if applicable. If not applicable provide reason why)
  • Tab order and focus state work as expected
  • Changes have been tested against screen readers (if applicable. If not applicable provide reason why)
  • New components are covered by e2e tests; updates to existing components are covered by existing test suite
  • Changes have been tested in vets-website using Verdaccio (if applicable. If not applicable provide reason why)

Screenshots

vaInputChange event before:

Screenshot 2024-05-14 at 3 21 26 PM

vaInputChange event after

Screenshot 2024-05-14 at 3 21 59 PM

vaCheckBoxChange event before

Screenshot 2024-05-14 at 3 26 18 PM

vaCheckboxChange event after

Screenshot 2024-05-14 at 3 26 51 PM

Acceptance criteria

  • QA checklist has been completed
  • Screenshots have been attached that cover desktop and mobile screens

Definition of done

  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)

@@ -161,7 +167,7 @@ export class VaStatementOfTruth {
value={inputValue}
message-aria-describedby={inputMessageAriaDescribedby}
required
onInput={this.handleInputChange}
onVaTextInputChange={this.handleInputChange}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that I totally understand why we need two "change" events for va-text-input now: onInput and onVaTextInputChange. Can you help me understand why we couldn't continue to use the nativeonInput here and avoid having to modify va-text-input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs - you're right! I refactored to avoid using a custom event.

/**
* The event emitted when the input value of the va-text-input element changes.
*/
@Event() vaTextInputChange: EventEmitter;
Copy link
Contributor

Choose a reason for hiding this comment

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

Follow on my previous comment, I'm curious if instead of a new custom event here in va-text-input, it could instead be in va-statement-of-truth so that we can keep using the native onInput event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs - see above!

Copy link
Contributor

@jamigibbs jamigibbs left a comment

Choose a reason for hiding this comment

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

Very clean! ✨

@it-harrison it-harrison merged commit e3a4196 into main May 15, 2024
9 checks passed
@it-harrison it-harrison deleted the 2783-va-statement-truth-bug branch May 15, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Patch change in semantic versioning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Statement of Truth change events do not contain the form values
4 participants