-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: useTag hook #7394
base: main
Are you sure you want to change the base?
fix: useTag hook #7394
Conversation
}, | ||
rowProps: mergeProps(rowProps, domProps, linkProps, { | ||
tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1, | ||
tabIndex: getTabIndex(isDisabled, isFocused, isNonFocused), |
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.
Thank you for the opportunity to resolve this issue.
I solved an issue where the TabGroup component was deleted when it was disalbed.
I don't think it's a good code, but if there is a better code or something wrong, please point it out. thanks!
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.
Thanks for the PR. It looks like you've run prettier or something equivalent over the file. Would you mind undoing that so that we can review the actual change? right now there is a bunch of noise and things that will fail our lint. Thanks again!
@snowystinger Thank you for your help. Edit completed! |
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.
Thanks for the quick update!
Would you mind adding a test for this?
let isNonFocused = state.selectionManager.focusedKey == null; | ||
function getTabIndex( | ||
isDisabled: boolean, | ||
isFocused: boolean, | ||
isNonFocused: boolean | ||
) { | ||
if (isDisabled) { | ||
return -1; | ||
} | ||
return isFocused || isNonFocused ? 0 : -1; | ||
} | ||
|
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.
let isNonFocused = state.selectionManager.focusedKey == null; | |
function getTabIndex( | |
isDisabled: boolean, | |
isFocused: boolean, | |
isNonFocused: boolean | |
) { | |
if (isDisabled) { | |
return -1; | |
} | |
return isFocused || isNonFocused ? 0 : -1; | |
} | |
let tabIndex = -1; | |
f (!isDisabled && (isFocused || state.selectionManager.focusedKey == null)) { | |
tabIndex = 0; | |
} |
We can just derive it as part of render, no need to add an additional function call with arguments we already have.
Closes #7080
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: