-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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(Dropdown): support disabled items #12407
feat(Dropdown): support disabled items #12407
Conversation
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
if ( | ||
!_.isNil(highlightedIndex) && | ||
this.state.filteredItems.length && | ||
!this.props.items[highlightedIndex]['disabled'] |
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.
It will not work with old render callback, but it's already deprecated:
const items = [render => render("foo")];
@@ -867,6 +867,7 @@ class Dropdown extends AutoControlledComponent<WithAsProp<DropdownProps>, Dropdo | |||
...getItemProps({ | |||
item, | |||
index, | |||
disabled: !!item['disabled'], |
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.
disabled: !!item['disabled'], | |
disabled: item['disabled'], |
Is it really required?
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.
double checked in downshift and it's not. will remove, thanks!
* add disabled prop to DropdownItem * use disabled prop in downshift getItemProps * prevent selection by Tab on disabled items * add unit tests * use item directly in function * changelog * remove boolean conversion
Pull request checklist
$ yarn change
Description of changes
Downshift already supports handling
disabled
as a key in the item object. We need to pass that from ourDropdown
togetItemProps
in order to make it work.Fully functional disabled item navigation should be achievable by updating to Downshift https://github.com/downshift-js/downshift/releases/tag/v4.0.1 or above.
Focus areas to test
(optional)
Microsoft Reviewers: Open in CodeFlow