-
Notifications
You must be signed in to change notification settings - Fork 83
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: scroll to correct focused row on keyboard navigation #8003
fix: scroll to correct focused row on keyboard navigation #8003
Conversation
const targetRowInDom = [...this.$.items.children].find((child) => child.index === index); | ||
if (!targetRowInDom) { | ||
this.scrollToIndex(index); | ||
this._scrollToFlatIndex(index); |
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.
note: We forgot to update __ensureFlatIndexInViewport
after we changed the signature of scrollToIndex
to support scrolling to hierarchical indexes.
|
||
// Ensure the correct element is set as focusable after scrolling. | ||
// The virtualizer may use a different element to render the item. | ||
this.__updateItemsFocusable(); |
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.
note: The previous version didn't update the focusable element if it was a row, which often resulted in a wrong row getting focused.
// Let's use a count lower than pageSize so we can ignore page + pageSize for now | ||
const itemsOnEachLevel = 5; | ||
const itemsOnEachLevel = 100; |
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.
nit: This is no longer lower than page size so the comment does not apply anymore (and the data provider should be updated to take page + pageSize into account).
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.
Oh, good catch! I completely forgot to add pagination now that the size has increased. Fixed.
Quality Gate passedIssues Measures |
Hi @vursen and @vursen, when i performed cherry-pick to this commit to 24.5, i have encountered the following issue. Can you take a look and pick it manually? |
Hi @vursen and @vursen, when i performed cherry-pick to this commit to 24.4, i have encountered the following issue. Can you take a look and pick it manually? |
) Co-authored-by: Sergey Vinogradov <[email protected]>
) Co-authored-by: Sergey Vinogradov <[email protected]>
Description
Fixes the regression where keyboard navigation could cause the grid to scroll to and focus a wrong row, especially when some items were expanded.
Fixes #7991
Type of change