-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[TreeView] Scroll jump bug #24096
Labels
bug 🐛
Something doesn't work
component: tree view
TreeView, TreeItem. This is the name of the generic UI component, not the React module!
good first issue
Great for first contributions. Enable to learn the contribution process.
Comments
This comment was marked as resolved.
This comment was marked as resolved.
@oliviertassinari here you go: https://codesandbox.io/s/scroll-jump-bug-24096-forked-o2q9h Just add some content before the tree, and page needs to have scroll. |
@bumTomica Thanks for reporting the issue. @joshwooding What do you think about this fix? diff --git a/packages/material-ui-lab/src/TreeItem/TreeItem.js b/packages/material-ui-lab/src/TreeItem/TreeItem.js
index 742f6663e5..54b960cebf 100644
--- a/packages/material-ui-lab/src/TreeItem/TreeItem.js
+++ b/packages/material-ui-lab/src/TreeItem/TreeItem.js
@@ -223,7 +223,7 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
function handleFocus(event) {
// DOM focus stays on the tree which manages focus with aria-activedescendant
if (event.target === event.currentTarget) {
- ownerDocument(event.target).getElementById(treeId).focus();
+ ownerDocument(event.target).getElementById(treeId).focus({ preventScroll: true });
}
const unfocusable = !disabledItemsFocusable && disabled; |
Looks good |
1 task
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug 🐛
Something doesn't work
component: tree view
TreeView, TreeItem. This is the name of the generic UI component, not the React module!
good first issue
Great for first contributions. Enable to learn the contribution process.
When Tree View has a larger height than the window height, clicking Tree Items first jumps the position of the item to the top and then on the second click toggles. See the video, please.
A similar thing happens in the last items too - it just positions the element to the bottom and it is really hard to click it then.
Items in the middle seem fine.
Official doc examples have the same problem.
treeview-scroll-bug.mov
Versions
v5.0.0-alpha.20
The text was updated successfully, but these errors were encountered: