diff --git a/images/chevron-small.svg b/images/chevron-small.svg new file mode 100644 index 000000000..657abe18b --- /dev/null +++ b/images/chevron-small.svg @@ -0,0 +1,3 @@ + + + diff --git a/mu-plugins/blocks/sidebar-container/postcss/style.pcss b/mu-plugins/blocks/sidebar-container/postcss/style.pcss index d923d2239..eb0a72ef0 100644 --- a/mu-plugins/blocks/sidebar-container/postcss/style.pcss +++ b/mu-plugins/blocks/sidebar-container/postcss/style.pcss @@ -34,6 +34,16 @@ &.is-fixed-sidebar .is-link-to-top, &.is-bottom-sidebar .is-link-to-top { display: block; + margin-top: 0; + + & a { + color: var(--wp--preset--color--charcoal-4); + } + } + + & > .wp-block-group:has(.wp-block-wporg-table-of-contents) + .is-link-to-top { + border-top: 1px solid var(--wp--preset--color--light-grey-1); + padding-top: var(--wp--preset--spacing--20); } } } diff --git a/mu-plugins/blocks/sidebar-container/src/view.js b/mu-plugins/blocks/sidebar-container/src/view.js index d910d5814..c24218467 100644 --- a/mu-plugins/blocks/sidebar-container/src/view.js +++ b/mu-plugins/blocks/sidebar-container/src/view.js @@ -89,19 +89,13 @@ function init() { const list = container?.querySelector( '.wporg-table-of-contents__list' ); if ( toggleButton && list ) { - // If the page is at least two columns, expand the toggle by default. - if ( window.matchMedia( '(min-width: 1200px)' ).matches ) { - toggleButton.setAttribute( 'aria-expanded', true ); - list.removeAttribute( 'style' ); - } - toggleButton.addEventListener( 'click', function () { if ( toggleButton.getAttribute( 'aria-expanded' ) === 'true' ) { toggleButton.setAttribute( 'aria-expanded', false ); - list.setAttribute( 'style', 'display:none;' ); + list.removeAttribute( 'style' ); } else { toggleButton.setAttribute( 'aria-expanded', true ); - list.removeAttribute( 'style' ); + list.setAttribute( 'style', 'display:block;' ); } // Use the same media query that determines whether it's 2 columns, diff --git a/mu-plugins/blocks/table-of-contents/index.php b/mu-plugins/blocks/table-of-contents/index.php index 4f85ccb38..2014589d5 100644 --- a/mu-plugins/blocks/table-of-contents/index.php +++ b/mu-plugins/blocks/table-of-contents/index.php @@ -56,14 +56,17 @@ function render( $attributes, $content, $block ) { $title = apply_filters( 'wporg_table_of_contents_heading', __( 'In this article', 'wporg' ), $post->ID ); $content = '
'; - $content .= '

' . esc_html( $title ) . '

'; + $content .= do_blocks( + ' +

' . esc_html( $title ) . '

+ ' + ); $content .= ''; $content .= '
'; - $content .= '