-
Notifications
You must be signed in to change notification settings - Fork 130
Support :single as select_variant for TreeView #3712
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
base: main
Are you sure you want to change the base?
Support :single as select_variant for TreeView #3712
Conversation
🦋 Changeset detectedLatest commit: 3efdf34 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 |
2830c52 to
08f3379
Compare
| this.checkAtPath(path) | ||
| } | ||
|
|
||
| toggleCheckedAtPath(path: string[]) { |
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.
Does this method work as expected in single-select mode?
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.
It looks like this method is not used at all any more (?), so I will delete it..
08f3379 to
3efdf34
Compare
|
Thanks for the feedback @camertron Very much appreciated 🙇 👍 |
What are you trying to accomplish?
Allow
select_variant: :singleforPrimer::Alpha::TreeView. The goal is to allow the TreeView to behave like a single-select component — meaning only one item can be selected at a time. This is particularly useful in scenarios where the user should choose one item out of many in a hierachy (similar to a radio button group).Screenshots
Integration
It should not, as it only adding an option
List the issues that this change affects.
Closes #3701
Risk Assessment
What approach did you choose and why?
I based my current draft on the implementation on how SelectPanel handles single-selection. Specifically:
select_variant: :multipleworks.One difference from the SelectPanel is the position of the checkmark. In the TreeView, the checkmark is shown at the end of the line rather than the beginning.
This was necessary because placing the checkmark at the start of the line led to large visual gaps — especially since most items do not show a checkmark at all.
The current placement helps maintain a more consistent and compact layout.
Anything you want to highlight for special attention from reviewers?
Currently, it is impossible to deselect an item once a selection was made. I copied that behaviour from the SelectPanel as well, but that is up for discussion.
Accessibility
Since the selection is made via the
aria-checked, the current selection is accessible for screen reader usersThe TreeView can be used via KeyBoard:
Merge checklist