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

feat: add select component #4074

Merged
merged 19 commits into from
Nov 18, 2020
Merged

feat: add select component #4074

merged 19 commits into from
Nov 18, 2020

Conversation

radium-v
Copy link
Collaborator

@radium-v radium-v commented Oct 26, 2020

Description

This PR adds the <fast-option>, <fast-listbox>, and <fast-select> components.

open select component

Motivation & context

The fast-option is a fast version of the HTML option element. The component uses the option ARIA role. Clicking a fast-option will set its selected state to true.

The fast-listbox is a fast component that uses the listbox ARIA role. It can hold fast-option elements, and will be able to hold container elements (similar to optgroup) in the future. The arrow keys allow users to cycle through its children to change which fast-option is selected.

The fast-select is a fast version of the HTML select element. It contains a button, a slottable fast-listbox, and slotted fast-options. 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

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Adding or modifying component(s) in @microsoft/fast-components checklist

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@chrisdholt chrisdholt changed the title add select component feat: add select component Oct 26, 2020
@radium-v radium-v requested a review from eljefe223 October 26, 2020 22:02
@radium-v radium-v self-assigned this Oct 26, 2020
@radium-v radium-v mentioned this pull request Oct 26, 2020
12 tasks
* Option role.
* @public
*/
export enum OptionRole {
Copy link
Contributor

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?

Copy link
Collaborator

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?

Copy link
Member

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);
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@EisenbergEffect EisenbergEffect added this to the Release 2020-10 milestone Nov 2, 2020
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA menuitem }.
*
* @public
*/
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha okay

Copy link
Contributor

@marjonlynch marjonlynch left a 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)

@radium-v radium-v force-pushed the users/jokreitl/select-component branch from 35d9783 to 2ba7a49 Compare November 18, 2020 20:11
@radium-v radium-v force-pushed the users/jokreitl/select-component branch from 2ba7a49 to 9bcf8ee Compare November 18, 2020 20:16
@radium-v radium-v merged commit 6984027 into master Nov 18, 2020
@radium-v radium-v deleted the users/jokreitl/select-component branch November 18, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: select component
10 participants