-
Notifications
You must be signed in to change notification settings - Fork 601
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
feat: add select component #4074
Conversation
packages/web-components/fast-foundation/src/listbox/listbox.spec.ts
Outdated
Show resolved
Hide resolved
packages/web-components/fast-foundation/src/select/select.template.ts
Outdated
Show resolved
Hide resolved
* Option role. | ||
* @public | ||
*/ | ||
export enum OptionRole { |
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 see this used (though I could be missing it) - can it be removed?
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 options have roles, if so, maybe it's just missing the example/unit test?
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'd actually prefer we stay away from an enum here personally for option. I see this being used for checking the value in certain places, but enums can be costly as they grow over time and an option only ever should have a role of option. If we can remove this I think it would be better.
|
||
if (matches) { | ||
// this.setFocusOnOption(element); | ||
console.log(element); |
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.
does this area still need work?
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 entire handleTypeAhead
function is left mostly as-is from the original draft implementation. It needs to be fixed and cleaned up.
packages/web-components/fast-components/src/listbox/listbox.styles.ts
Outdated
Show resolved
Hide resolved
packages/web-components/fast-components/src/option/option.styles.ts
Outdated
Show resolved
Hide resolved
packages/web-components/fast-components/src/select/select.styles.ts
Outdated
Show resolved
Hide resolved
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA menuitem }. | ||
* | ||
* @public | ||
*/ |
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.
Does this need proxy logic? I don't think it is form-associated is it?
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 listbox-option isn't form-associated but it does hold its own option
element to make option manipulation with the form-associated select significantly easier.
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.
gotcha okay
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.
Smoked in explorer and storybook in Edge and Firefox and all expected changes looked good, keyboard navigation, scenario is there now (inserted a native html element in an option with great success)
- Adds the select, listbox, and option components
- rename option to listbox-option - add high contrast styles
- reduce id collisions for options
35d9783
to
2ba7a49
Compare
2ba7a49
to
9bcf8ee
Compare
Description
This PR adds the
<fast-option>
,<fast-listbox>
, and<fast-select>
components.Motivation & context
The
fast-option
is a fast version of the HTMLoption
element. The component uses theoption
ARIA role. Clicking afast-option
will set itsselected
state totrue
.The
fast-listbox
is a fast component that uses thelistbox
ARIA role. It can holdfast-option
elements, and will be able to hold container elements (similar tooptgroup
) in the future. The arrow keys allow users to cycle through its children to change whichfast-option
is selected.The
fast-select
is a fast version of the HTMLselect
element. It contains a button, a slottablefast-listbox
, and slottedfast-option
s. The button is displayed by default. Clicking the button will toggle the listbox to display the available options. Clicking an option will close the menu and change the button's display to reflect the selected option.Issue type checklist
Is this a breaking change?
Adding or modifying component(s) in
@microsoft/fast-components
checklistProcess & policy checklist