Skip to content

[Bug]: Dropdown does not function as expected and docs need to illustrate basic actual usage. #34512

Closed
@dzearing

Description

@dzearing

Component

Dropdown

Package version

latest v9

React version

17

Environment

Edge, @fluentui/react-components latest, react 17.

Current Behavior

Given this:

<Dropdown value={0} onChange={ (value) => console.log(value); }>
   <Option value={0}>Text for 0</Option>
   <Option value={1}>Text for 1</Option>
   <Option value={2}>Text for 2</Option>
</Dropdown>

Expectations/Results:

  • We should be displaying "Text for 0" but instead, the value 0 is displayed as the selected item.
  • There should be a single way to specify the selected item - not 2. Either value or selectedOptions but not both. Pick one. Provide examples in documentation.
  • There should be a single event fired when selection changes, but not 2. Pick one. Provide examples in documentation.
  • Went to the controlled component usage example in docs - the first thing you see is uncontrolled usage example. What?

Expected Behavior

See all of the behaviors above.

Reproduction

https://stackblitz.com/edit/osrzayhe-mnd1lovb?file=src%2Fexample.tsx

Steps to reproduce

  1. Use the actual component in a product as a controlled component. Don't know how to listen for change events or select a default value? Read the docs.
  2. Try not to get frustrated.

Please fix! It's a beautiful component, just has some significant ergonomics and docs issues right now.

Are you reporting an Accessibility issue?

None

Suggested severity

Urgent - No workaround and Products/sites are affected

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions