-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add uswds combo box #1373
base: main
Are you sure you want to change the base?
Add uswds combo box #1373
Conversation
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.
Thank you so much @oleksii-morgun for working on this! This is going to be a really nice addition to the component library. I've just left a few questions and comments for discussion. I've also tagged our designer group to have a look too when they have a chance. 🙇🏼♀️
onChange={e => this.handleChange(e)} | ||
disabled={disabled} | ||
> | ||
{this.populateOptions()} |
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.
The spacing for the dropdown options don't match USWDS. Are we able to sync that up with their style module?
It also looks like our input has rounded corners but they are square.
Storybook
USWDS Example*
@import '../../mixins/uswds-input-width.scss'; | ||
@import '../../mixins/uswds-error-border.scss'; | ||
|
||
|
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.
We diverge a little bit with USWDS and use a yellow border on focus instead of blue so we'll want to do that with the combobox as well.
Here is an example of the yellow focus border on va-input:
We have a mixin that you can import here should make that update for you:
@import '../../mixins/focusable.css';
); | ||
}); | ||
|
||
it('renders disabled', 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.
At a minimum we'd like to see a test for every prop and custom event for the component. That means I'd expect a minimum of 12 or so tests here but I only see 7. Do you mind beefing up these tests a little bit more?
|
||
/** | ||
* @componentName Combo Box | ||
* @maturityCategory dont_use |
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.
I wonder if this should be Use With Caution: Candidate? 🤔
Here are the guidelines for the maturity scale.
The Use With Caution: Candidate requirements say:
- Design System Team and/or Design System Council have evaluated the proposal.
- The Design System Team will be creating documentation for the component or pattern.
- The component or pattern may be in limited use (i.e. it may have already been shipped by a team). This could also be known as: “In work”, “Draft”, “Beta”, or “Give it a go! YMMV”.
Disabled.args = { | ||
...defaultArgs, | ||
value: 'elderberry', | ||
disabled: true, |
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.
I don't think we want to advertise that there is a disabled state. There are a11y concerns with this functionality.
Or maybe we don't want to have this functionality in the component at all? I will let the design and a11y reviewers weigh in on that though. cc @department-of-veterans-affairs/platform-design-system-designers @rsmithadhoc
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.
Yeah, our stance on disabled states is that instead of disabling something, just don't show it if it serves no purpose. I'm okay with leaving it in for parity with USWDS, but just not advertising it.
composed: true, | ||
bubbles: true, | ||
}) | ||
componentLibraryAnalytics: EventEmitter; |
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.
I've been advised previously by @jestutt from platform analytics that we should not add analytics code to a component until we have coordinated with her. So I think we should remove any custom analytics code for now and we'll create a follow-up ticket to get it added.
Unless @oleksii-morgun your team needs it for your user testing?
} | ||
const inputElement = this.el.shadowRoot.querySelector('input'); | ||
if (inputElement && this.error) { | ||
inputElement.classList.add('usa-input--error'); |
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.
Do you mind explaining a little more why displaying the error needs to be done in a component lifecycle instead of just using conditional markup in the render?
const labelElement = this.el.shadowRoot.querySelector('label'); | ||
if (comboBoxElement) { | ||
comboBox.init(comboBoxElement, labelElement); | ||
comboBox.on(comboBoxElement); |
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.
I'm not sure I understand why the label needs to be added in this way instead of just in the markup. Do you mind clarifying?
forceUpdate(this.el); | ||
}); | ||
if (!this.label) { | ||
throw new Error('va-combo-box: label is a required property'); |
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.
I'm not sure about this approach for throwing an Error on required props. 🤔 Generally we will just allow the markup for the prop to display or not display.
action: 'change', | ||
details: { | ||
label: this.label, | ||
selectLabel: this.value, |
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.
Analytics will need to be coordinated with @jestutt before we can add this.
@jamigibbs thank you for a thorough review. I will have to get back to this the following week as I am out next week. And will look deeper into your suggestions. |
I'll have to give this a test with our accessibility testing criteria, |
Chromatic
https://add-uswds-combo-box--65a6e2ed2314f7b8f98609d8.chromatic.com
Description
Related to department-of-veterans-affairs/vets-design-system-documentation#3154
Designs https://www.figma.com/design/uddjxccqvUyz5FSg1aD5wi/ZFeat---Triage-Group-Selection-Flows?node-id=1804-73207&node-type=canvas&t=Rhhpivvbmxpw3vw2-0
USWDS combobox: https://designsystem.digital.gov/components/combo-box/
QA Checklist
Screenshots
Acceptance criteria
Definition of done