-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(#1316) Disabled keys not passing isDisable prop to item #1498
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
Conversation
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.
Looks good, just one small suggestion, lemme know what you think
@@ -128,7 +128,7 @@ import {mergeProps} from '@react-aria/utils'; | |||
|
|||
function Menu(props) { | |||
// Create state based on the incoming props | |||
let state = useTreeState({...props, selectionMode: 'none'}); | |||
let state = useTreeState({...props, disabledKeys:['one'], selectionMode: 'none'}); |
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.
Just a small suggestion: I think this disabledKeys
should be passed in as one of the Menu props like so
<Menu onAction={alert} aria-label="Actions" disabledKeys={["one"]}>
<Item key="one">One</Item>
<Item key="two">Two</Item>
<Item key="three">Three</Item>
</Menu>
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.
yeah, better will change it.
let {menuItemProps} = useMenuItem({ | ||
key: item.key, | ||
isDisabled: item.isDisabled, | ||
isDisabled: isDisabled, |
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.
keep isDisabled: isDisabled
or go for shorthand just isDisabled
?
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.
shorthand IMO
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.
LGTM, thanks for contributing!
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.
lgtm!
Closes #1316
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: