Skip to content

fix(treeview): update Treeview margin and focus border to use Spectrum tokens #3257

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/treeview/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

.spectrum-TreeView {
--spectrum-treeview-line-height: var(--spectrum-line-height-200);
--spectrum-treeview-margin-block: 1em;
--spectrum-treeview-margin-block: var(--spectrum-spacing-300);;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this! Unfortunately, the spacing-300 value does not resolve to the same rendered result as 1em since the ems are relative values to the typography. This was an intentional choice made for tree view to ensure spacing mirrors the sizing of the content.

--spectrum-treeview-font-size: var(--spectrum-font-size-100);

--spectrum-treeview-item-min-block-size: var(--spectrum-component-height-100);
Expand All @@ -28,7 +28,7 @@
--spectrum-treeview-heading-color: var(--spectrum-heading-color);

--spectrum-treeview-item-border-size: var(--spectrum-border-width-200);
--spectrum-treeview-item-border-size-selected: 1px;
--spectrum-treeview-item-border-size-selected: var(--spectrum-divider-thickness-small);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though this resolves to 1px, we don't mix component-level tokens like this in our system. We'd need to have a --spectrum-tree-view-divider-thickness value (or something of the like) added to the token data in order to update this.

--spectrum-treeview-item-border-radius: 0px;

--spectrum-treeview-item-border-color-selected: var(--spectrum-blue-800);
Expand Down
2 changes: 2 additions & 0 deletions components/treeview/metadata/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"--spectrum-disclosure-indicator-top-to-disclosure-icon-large",
"--spectrum-disclosure-indicator-top-to-disclosure-icon-medium",
"--spectrum-disclosure-indicator-top-to-disclosure-icon-small",
"--spectrum-divider-thickness-small",
"--spectrum-font-size-100",
"--spectrum-font-size-200",
"--spectrum-font-size-300",
Expand All @@ -166,6 +167,7 @@
"--spectrum-line-height-200",
"--spectrum-logical-rotation",
"--spectrum-neutral-content-color-default",
"--spectrum-spacing-300",
"--spectrum-text-to-visual-75"
],
"system-theme": [],
Expand Down