-
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
va-combo-box: add option groups functionality #1478
base: main
Are you sure you want to change the base?
Conversation
@BobbyBaileyRB has conducted a11y testing on our end as well |
@@ -46,6 +46,27 @@ const defaultArgs = { | |||
], | |||
}; | |||
|
|||
const optGroupArgs = { |
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.
Please move this down to just before the export const OptGroups
below so that it's more obvious that these args go with that template.
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.
👍🏻
<option value="Potatoes">Potatoes</option> | ||
</optgroup> | ||
<option value="sweet-potatoes">Sweet Potatoes</option> | ||
<option value="cherry">Cherry</option> |
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 believe most people would be likely to associate "Cherry" and "Clementine" as "Fruits", not "Vegetables".
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.
In this case, Sweet potatoes
, Cherry
, and Clementine
are intended to fall in neither of those two categories to demonstrate that options can be either nested or not. Maybe I just need to pick examples that are distinctively different from those categories. I also wanted to pick some non nested values outside of an <optgroup>
that have matching segments, to demonstrate filter functionality too
@@ -115,3 +136,8 @@ WithMessageAriaDescribedBy.args = { | |||
...defaultArgs, | |||
messageAriaDescribedby: 'This is example aria message', | |||
}; | |||
|
|||
export const OptGroups = Template.bind({}); |
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.
Please expand the name of this template variable to "OptionGroups", as Storybook will automatically expand this to "Option Groups". "Opt Groups" is not "obvious" enough, in my opinion.
@@ -368,6 +370,8 @@ const noop = () => {}; | |||
return new RegExp(find, 'i'); | |||
}; | |||
|
|||
const isDataOptGroup = option => option.getAttribute('data-optgroup') !== null; |
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.
This should probably be expanded to include && option.getAttribute('data-optgroup') !== false
.
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.
now that I am giving this another look, it probably should just be option.getAttribute('data-optgroup') === 'true';
if (!inputValue){ | ||
options.push(optionEl); | ||
continue; | ||
} | ||
|
||
if ( | ||
inputValue && | ||
regex.test(optionEl.text) && | ||
optionEl.getAttribute('data-optgroup') !== 'true' | ||
) { | ||
if ( | ||
optionEl.getAttribute('data-optgroup-option') === 'true' && | ||
parentOptGroupId !== optionEl.getAttribute('aria-describedby') | ||
) { | ||
parentOptGroupId = optionEl.getAttribute('aria-describedby'); | ||
const parentOptgroupEl = selectEl.querySelector( | ||
'#' + parentOptGroupId, | ||
); | ||
options.push(parentOptgroupEl); | ||
} | ||
options.push(optionEl); | ||
} |
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.
Can you add some comments to help make it more obvious what this code is doing?
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.
Hey @oleksii-morgun! Thanks for working on this some more, we really appreciate the contribution. When you have a spare moment, would you mind leaving some review comments around the stuff going on va-combo-box-library.js
and va-combo-box.tsx
, just so we have a little more context? Thanks!
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 current deployment of Storybook shows that when a user selects the dropdown arrow to look at the available options, the focus ring moves to the first item in the list and is being highlighted in the focus default yellow #FACE00
However, with this updated link it appears that the focus color has changed to black:
Correct me if I'm wrong, but I believe this should be in the focus yellow color mentioned above.
I'm guessing that the main reason for this is because, when an item from the list is selected and the user reengages the dropdown button, the highlighted option is shown in dark blue and if the black default color were used, I'm not sure it would pass a11y due to lack of contrast with the dark colors used, as shown here:
But perhaps @rsmithadhoc could provide some more insight on this particular issue?
@LWWright7
For those reasons, I think the current version should be fine. |
definitely. |
re: #1478 (review) @LWWright7 here is a reference to a thread where this was brought up by @BobbyBaileyRB and it seems to align with @rsmithadhoc point. But I am open to your collective guidance here |
re: #1478 (comment) @JoelCalumpong any concerns from Design perspective? I know we are considering this primarily for recipient list where we are trying to save as much real estate as possible. |
I pushed updates addressing some concerns and including feedback followup from all your input. Only item pending is the padding confirmation by our design team @JoelCalumpong. Other than that, should be ready for re-review when y'all have. a chance please |
Chromatic
https://combobox-option-groups--65a6e2ed2314f7b8f98609d8.chromatic.com
Configuring this pull request
major
,minor
,patch
, orignore-for-release
).ignore-for-release
if files haven't been changed in a component library package. (ie. only Storybook files)/packages/core
version number if this will be the last PR merged before a release.Description
https://www.figma.com/design/uddjxccqvUyz5FSg1aD5wi/Z---Triage-Group-Flows?node-id=2095-166308&t=N9EvV05ND53hcKNY-0
optgroup
tag that is expected to behave similar toselect
dropdownoptgroup
optgroup
is transformed to a<li>
in a combobox listoptgroup
receives custom distinct stylingoptgroup
is not selectable or searchableoption
elements of anoptgroup
receivearia-describedby
of anoptgroup
they are associated withoption
element that matches the search query is displayed along with its parentoptgroup
elementQA Checklist
Screenshots
Acceptance criteria
Definition of done