Skip to content

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

Merged
merged 6 commits into from
Feb 25, 2021

Conversation

razvanip
Copy link
Contributor

@razvanip razvanip commented Jan 23, 2021

Closes #1316

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@razvanip razvanip changed the title Issue 1316 fix(#1316) Disabled keys not passing isDisable prop to item Jan 23, 2021
Copy link
Member

@LFDanLu LFDanLu left a 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'});
Copy link
Member

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>

Copy link
Contributor Author

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,
Copy link
Contributor Author

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 ?

Copy link
Member

Choose a reason for hiding this comment

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

shorthand IMO

Copy link
Member

@LFDanLu LFDanLu left a 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!

@devongovett devongovett added the documentation Improvements or additions to documentation label Feb 1, 2021
Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

lgtm!

@dannify dannify merged commit a7dabb4 into adobe:main Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled keys not passing isDisable prop to item
5 participants