Skip to content

Commit

Permalink
Create positioning context for 3 column layout (#140)
Browse files Browse the repository at this point in the history
Gutenberg 18.5 added position:relative to all constrained blocks, breaking the 3 column layout.
This change adds makes the layout less brittle by defining it's own positioning context, and adjusts position of the children accordingly.

See #139
  • Loading branch information
adamwoodnz authored Jun 11, 2024
1 parent 65fbabc commit 510f60c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
.has-three-columns {
--local--sidebar--width: 248px;
--local--column-gap: 40px;
position: relative;
justify-content: flex-end;
max-width: 100%;

Expand All @@ -45,6 +46,7 @@

main {
order: 1;
padding-top: var(--wp--preset--spacing--20);
}

article {
Expand All @@ -53,11 +55,12 @@

// Left sidebar: Typically Chapter List
> .wp-block-wporg-sidebar-container {
margin-top: var(--wp--preset--spacing--20);
padding-top: var(--wp--preset--spacing--20);
}

// Right sidebar: Typically Table of Contents
article .wp-block-wporg-sidebar-container {
margin-block-start: 0;
margin-bottom: var(--wp--preset--spacing--50);
}

Expand Down Expand Up @@ -91,7 +94,9 @@
margin-right: auto;

.wp-block-wporg-sidebar-container {
inset-inline-end: var(--wp--preset--spacing--edge-space);
padding-top: var(--wp--preset--spacing--20);
inset-inline-end: calc((var(--local--block-end-sidebar--width) * -1) - var(--local--column-gap));
inset-block: 0;
}
}
}
Expand Down

0 comments on commit 510f60c

Please sign in to comment.