Skip to content
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

List View: try respecting a max width #35605

Closed
wants to merge 2 commits into from
Closed
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 packages/block-editor/src/components/list-view/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@
width: $icon-size;
}

// First level of indentation is aria-level 2, max indent is 8.
// First level of indentation is aria-level 2, max indent is 15.
// Indent is a full icon size, plus 4px which optically aligns child icons to the text label above.
$block-navigation-max-indent: 8;
$block-navigation-max-indent: 15;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want to allow arbitrary levels, it'd be ideal to be able to do some margin-left: calc( $icon-size * $aria-level ). Unfortunately it doesn't look like https://developer.mozilla.org/en-US/docs/Web/CSS/attr() has good support, so we bump this to a highish number that doesn't generate too much css from:

@for $i from 0 to $block-navigation-max-indent {
	.block-editor-list-view-leaf[aria-level="#{ $i + 1 }"] .block-editor-list-view__expander {
		@if $i - 1 >= 0 {
			margin-left: ( $icon-size * $i ) + 4 * ($i - 1);
		}
		@else {
			margin-left: ( $icon-size * $i );
		}
	}
}

.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander {
margin-left: ( $icon-size ) * $block-navigation-max-indent + 4 * ( $block-navigation-max-indent - 1 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

.edit-post-editor__list-view-panel-content {
overflow-y: auto;
overflow-x: auto;
max-width: 340px;
// The table cells use an extra pixels of space left and right. We compensate for that here.
padding: $grid-unit-10 ($grid-unit-10 - $border-width - $border-width);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@

.edit-site-editor__list-view-panel-content {
overflow-y: auto;
overflow-x: auto;
max-width: 350px;
padding: $grid-unit-10;
}