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

Use correct classname for nested Navigation Link container #29380

Merged
merged 2 commits into from
Feb 27, 2021
Merged
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
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export default function NavigationLinkEdit( {

const innerBlocksProps = useInnerBlocksProps(
{
className: classnames( 'wp-block-navigation__container', {
className: classnames( 'wp-block-navigation-link__container', {
'is-parent-of-selected-block':
isParentOfSelectedBlock &&
// Don't select as parent of selected block while dragging.
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/navigation-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,8 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
$inner_blocks_html .= $inner_block->render();
}

// TODO - classname is wrong!
$html .= sprintf(
'<ul class="wp-block-navigation__container">%s</ul>',
'<ul class="wp-block-navigation-link__container">%s</ul>',
$inner_blocks_html
);
}
Expand Down
42 changes: 19 additions & 23 deletions packages/block-library/src/navigation-link/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,17 @@
position: relative;
margin: 0;

.wp-block-navigation__container:empty {
.wp-block-navigation-link__container:empty {
display: none;
}
}

.wp-block-navigation__container {
// Reset the default list styles
list-style: none;
margin: 0;
padding-left: 0;

// Horizontal layout
display: flex;
flex-wrap: wrap;

// Vertical layout

.is-vertical & {
display: block;
}
}

// Styles for submenu flyout
.has-child {
> .wp-block-navigation-link__content {
padding-right: 0.5em;
}
.wp-block-navigation__container {
.wp-block-navigation-link__container {
border: $border-width solid rgba(0, 0, 0, 0.15);
background-color: inherit;
color: inherit;
Expand All @@ -57,7 +40,7 @@
left: 1.5em;

// Nested submenus sit to the left on large breakpoints
.wp-block-navigation__container {
.wp-block-navigation-link__container {
left: 100%;
top: -1px;

Expand All @@ -83,7 +66,7 @@
&:hover {
cursor: pointer;

> .wp-block-navigation__container {
> .wp-block-navigation-link__container {
visibility: visible;
opacity: 1;
display: flex;
Expand All @@ -94,7 +77,7 @@
&:focus-within {
cursor: pointer;

> .wp-block-navigation__container {
> .wp-block-navigation-link__container {
visibility: visible;
opacity: 1;
display: flex;
Expand All @@ -103,9 +86,22 @@
}
}

// Default background and font color
.wp-block-navigation:not(.has-background) .wp-block-navigation__container {
.wp-block-navigation-link__container {
// Set a background color for submenus so that they're not transparent.
// NOTE TO DEVS - if refactoring this code, please double-check that
// submenus have a default background color, this feature has regressed
// several times, so care needs to be taken.
background-color: $white;
color: $gray-900;
}
}


// Force links to inherit text decoration applied to navigation block.
.wp-block-navigation[style*="text-decoration"] {
.wp-block-navigation__container,
.wp-block-navigation-link__container,
.wp-block-navigation-link {
text-decoration: inherit;
}
Expand Down
28 changes: 16 additions & 12 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// Default background and font color
.wp-block-navigation:not(.has-background) .wp-block-navigation__container {
.wp-block-navigation__container {
// Set a background color for submenus so that they're not transparent.
// NOTE TO DEVS - if refactoring this code, please double-check that
// submenus have a default background color, this feature has regressed
// several times, so care needs to be taken.
background-color: $white;
color: $gray-900;
}
}

.wp-block-navigation .wp-block-navigation__container {
.wp-block-navigation__container {
align-items: normal;
Expand All @@ -20,6 +8,22 @@
.wp-block-navigation__container {
// Vertically align child blocks, like Social Links or Search.
align-items: center;

// Reset the default list styles
list-style: none;
margin: 0;
padding-left: 0;

// Horizontal layout
display: flex;
flex-wrap: wrap;

// Vertical layout

.is-vertical & {
display: block;
}

}

.items-justified-center > ul {
Expand Down