Skip to content

Commit

Permalink
List View: Ensure long anchors don't cause the List View to extend (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Aug 11, 2022
1 parent 4151405 commit e21cbd6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Expand Up @@ -90,8 +90,13 @@ function ListViewBlockSelectButton(
<Truncate ellipsizeMode="auto">{ blockTitle }</Truncate>
</span>
{ blockInformation?.anchor && (
<span className="block-editor-list-view-block-select-button__anchor">
{ blockInformation.anchor }
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
<Truncate
className="block-editor-list-view-block-select-button__anchor"
ellipsizeMode="auto"
>
{ blockInformation.anchor }
</Truncate>
</span>
) }
{ isLocked && (
Expand Down
15 changes: 11 additions & 4 deletions packages/block-editor/src/components/list-view/style.scss
Expand Up @@ -312,14 +312,21 @@
}
}

.block-editor-list-view-block-select-button__anchor-wrapper {
position: relative;
max-width: min(110px, 40%);
width: 100%;
}

.block-editor-list-view-block-select-button__anchor {
position: absolute;
right: 0;
transform: translateY(-50%);
background: rgba($black, 0.1);
border-radius: $radius-block-ui;
display: inline-block;
padding: 2px 6px;
max-width: min(100px, 40%);
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
box-sizing: border-box;
}

&.is-selected .block-editor-list-view-block-select-button__anchor {
Expand Down

0 comments on commit e21cbd6

Please sign in to comment.