-
Notifications
You must be signed in to change notification settings - Fork 535
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
feat(TreeView): add support for Backspace to collapse a folder #2504
Conversation
🦋 Changeset detectedLatest commit: 4070655 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
I think pressing
|
Correct, @colebemis. @joshblack Backspace shouldn't collapse any nodes. It should move focus to the parent of the focused node, or do nothing if the focused node is a root node. But the state of nodes shouldn't change. |
Totally makes sense! Making those changes now 👍 Sorry about the confusion over behavior on my end. |
Wanted to call out this note from @jscholes:
In the storybook, the |
@colebemis / @joshblack Does this only apply on Mac? I.e. does |
@jscholes great question, I tried testing with the Delete key on Windows 10 real quick and it seems like As you noted, it does seem like on macOS it treats the delete key when in that classic |
@joshblack I think Fn+Backspace on Mac is Delete specifically. Backspace on its own is Backspace, so the current state should be good. |
Co-authored-by: Cole Bemis <colebemis@github.com>
Based on feedback here, this PR adds in support for
Backspace
to collapse a folder.Testing & Reviewing
You can verify that
Backspace
works by visiting a story for TreeView and expanding a folder. PressingBackspace
on the folder should not collapse it. If a parent item is available, focus should move to it. If the element is at the root, focus should not move.Screen.Recording.2022-10-31.at.4.00.02.PM.mov