feat: add pressedArrow property to TreeView#517
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a pressedArrow flag to TreeView so consumers can differentiate arrow-key navigation selection changes from mouse-driven selection in select/deselect handlers (mirroring the existing pressedCtrl/pressedShift pattern).
Changes:
- Introduces internal
_pressedArrowstate and exposes it viaget pressedArrow(). - Sets
_pressedArrowtrue during arrow-key navigation handling in_onChildKeyDown, then resets it after handling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Expose whether a selection change was triggered by arrow key navigation, following the same pattern as pressedCtrl and pressedShift. Made-with: Cursor
0b18e08 to
ef778de
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pressedArrowproperty toTreeView, following the same pattern aspressedCtrlandpressedShiftselect/deselectevent handlersMotivation
The PlayCanvas Editor's Assets panel has a folder TreeView where clicking a folder once navigates into it, and clicking it again shows it in the Inspector. When using arrow keys to navigate between folders, the Inspector should update — but the
selectevent provides no way to distinguish keyboard navigation from mouse clicks.This adds the missing piece:
pressedArrowistrueduringselect/deselectevents triggered by arrow key navigation in_onChildKeyDown, andfalseotherwise.API
Test plan
pressedArrowistrueinsideselect/deselecthandlers during arrow key navigationpressedArrowisfalseinsideselect/deselecthandlers during mouse clickspressedCtrlandpressedShiftbehavior is unchanged