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-button & va-button-pair: allow custom text for continue variation #1485

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jamigibbs
Copy link
Contributor

@jamigibbs jamigibbs commented Feb 6, 2025

Chromatic

https://3724-button-continue--65a6e2ed2314f7b8f98609d8.chromatic.com

Description

This will allow for a button text override when the continue variation is being used for va-button and va-button-pair. The default text will still be "Continue".

Notes from DSC meeting about opening up button component text: department-of-veterans-affairs/vets-design-system-documentation#2362 (comment)

Closes department-of-veterans-affairs/vets-design-system-documentation#3724

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

Screenshot 2025-02-07 at 11 50 39 AM

Screenshot 2025-02-07 at 11 50 00 AM

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)

@jamigibbs jamigibbs added the patch Patch change in semantic versioning label Feb 6, 2025
alert ("form onsubmit method fired!--on form");
handleSubmit : (event)=>{
console.log("Form onSubmit callback fired!", event);
alert ("Form onSubmit callback fired!");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just some cleanup/clarification of the Storybook page. This is not related to the custom text update.

@jamigibbs jamigibbs marked this pull request as ready for review February 7, 2025 21:36
Copy link
Contributor

@Andrew565 Andrew565 left a comment

Choose a reason for hiding this comment

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

Approved but left a couple questions to ponder.

if (this.continue) return 'Continue';
if (this.back) return 'Back';
if (this.loading && !this.text) return 'Loading...';
return this.text;
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this lead to a situation where, if text is undefined, the button renders without text?

Also, by having the custom text take precedence, this appears to result in the "Loading..." text being unreachable. This means that devs would need to manually watch for and update the custom text prop themselves if they wanted it to represent a loading state, yes?

I don't know if these things need to change, just thinking out loud as to whether they're issues or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could this lead to a situation where, if text is undefined, the button renders without text?

This is what I wanted to test with a pre-release in vets-website to see if any e2e tests failed. 😄 Technically right now, you could not set this.text and there would be no default text unless a variation was also set (back or continue). So I don't think anything is changing with what it would already do now. I thought a pre-release could absolutely confirm though and I'm still mulling that over just for our sanity.

Also, by having the custom text take precedence, this appears to result in the "Loading..." text being unreachable. This means that devs would need to manually watch for and update the custom text prop

Yes, that's a good call-out and what you're describing is exactly what would need to be done. Here is the existing example in Storybook:

https://github.com/department-of-veterans-affairs/component-library/blob/main/packages/storybook/stories/va-button-uswds.stories.jsx#L112-L125

I wonder if that could be refactored to be less manual for devs? Maybe as a follow-up? 🤔

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.

Cannot change text of va-button using continue
2 participants