-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Actionlist tree-view CSS #1803
Actionlist tree-view CSS #1803
Conversation
🦋 Changeset detectedLatest commit: b9ce8c9 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 |
// --ActionList-tree-depth is defined as an inline style referencing the aria-level of each item ie: aria-level="2" | ||
// stylelint-disable-next-line selector-max-specificity, max-nesting-depth, selector-max-compound-selectors, primer/spacing | ||
.ActionList-content { | ||
padding-left: calc(#{$spacer-2} * var(--ActionList-tree-depth)); |
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.
padding-left: calc(#{$spacer-2} * var(--ActionList-tree-depth)); | |
padding-left: calc($spacer-2 * var(--ActionList-tree-depth)); |
Does this work?
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 compiles correctly, but still getting a lint error. This is definitely a tomorrow problem 😂
Not sure if this came up before, but have we considered adding a tree-view as its own component? Maybe as Or maybe there could be a separate
Just trying to think about ways how to avoid making /cc @vdepizzol |
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.
I agree that it feels tight. Originally I had it much more spaced out, but the use case for this component requires a much more condensed design. I thought about adding a prop for |
Definitely worth bringing up so thank you! The way you broke it down essentially is how I'm thinking about it. I separated "components" into their own files, but inevitably they still have dependencies between them. For |
@simurai +1 to @langermank replies here :)) This tree view is initially appearing in sidebars, so horizontal spacing is crucial.
👍 👍 |
Overview
ActionList tree-view is a modifier for ActionList:
.ActionList--tree
. It uses default styles from.ActionList
with sensible defaults for a tree-grid or tree-view scenario.Updating ActionList to use ActionList--tree
ActionList ActionList--tree
ActionList ActionList--subGroup
ActionList-item ActionList-item--hasSubItem
aria-level="" aria-setsize="" aria-posinset=""
ActionList-item ActionList-item--subItem
aria-level="" aria-setsize="" aria-posinset=""
ActionList-content
aria-level
: this should be a number (starting at 1) indicating the hierarchical structure of the tree. The easiest way to understand how it works for tree-view is to inspect this story in Storybook. There should be an inline style defining a CSS variable--ActionList-tree-depth: X
with the value fromaria-level
. This is what creates the nested styles.aria-setsize
andaria-posinset
are referenced in this tree example so I included them in my story.aria-setsize
: Defines the number of treeitem elements in the set of treeitem elements that are in the same branch and at the same level within the hierarchy.1aria-posinset
: Defines the position of the element within the set of other treeitem elements that are in the same branch and at the same level within the hierarchy.2This component still requires an official accessibility audit- these are recommendations based on my own research and have not yet been tested
Also note:
visual
modifier classes shouldn't be needed for tree-view -ActionList-content--visual16
for example can be removed from markup.Other fixes
ActionList-item
grid alignment tostart
for better multi-line supportActionList-content
(the contents of an item, usually thea href
) which allows the hover state to fully extend the container bounds. Scoped to expandable sections only.ActionList-item
to have a small font-size instead of defaulting to small for nested groups (nested groups will use this prop in PVC)Tree view fixes/additions
Footnotes
Role, Property, State, and Tabindex Attributes ↩
Role, Property, State, and Tabindex Attributes ↩