-
Notifications
You must be signed in to change notification settings - Fork 305
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(quick-search): Quick Search Navigation #3622
Conversation
@@ -613,7 +609,12 @@ function makeSelectable(BaseTable) { | |||
isTargetSlider = event => event.target?.role === 'slider'; | |||
|
|||
// Workaround for focus conflicting with Blueprint components in Search Quick Filters, not needed once Blueprint table is integrated |
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.
Can we update this comment, maybe put the comments directly above each case in isTargetQuickSearch
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
// Workaround for focus conflicting with Blueprint components in | ||
// QuickSearch result, recent items and Quick Filters | ||
isTargetQuickSearch = event => | ||
(event.target?.className && |
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.
🔧 this function feels hard to follow as there are multiple targets all &&
and ||
together. Can we use guard statements or variables to hold context as to what the selectors are?
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.
@TylerGauntlett good suggestion.
|
||
if ( | ||
className && | ||
(className.includes('quickSearchRecentItem') || className.includes('quickSearchResultItem')) |
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.
❓ optional chaining offer any value here? className?.includes
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.
Not sure it does since we are checking for className.
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.
I guess i mean dropping the className
check and using optional chaining in both
|
||
const { className, dataset } = event.target; | ||
|
||
if ( |
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.
🔧 might be worth adding comments over each of these if
blocks detailing exactly what its targeting. These class names might be a easy enough to put together with the comment overtop the function but the dataset strategy below becomes much harder
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.
Something like this
if (!event.target) {
return false;
}
const { className, dataset } = event.target;
// QuickSearch Recent Item
if (className?.includes('quickSearchRecentItem')) {
return true;
}
// Quick Search Result Item
if (className?.includes('quickSearchResultItem')) {
return true;
}
// Blueprint's <FilterChip>
if (dataset && ('radixCollectionItem' in dataset)) {
return true;
}
// Blueprint's <SmallList>
if (dataset && 'bpSmallListItem' in dataset) {
return true;
}
return false;
This fix adds logic to skip keyboard focus handlers for New Quick Search components