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

Try: Remove color inheritance specificity. #35725

Merged
merged 2 commits into from
Oct 19, 2021
Merged
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
15 changes: 6 additions & 9 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
}

// Menu item link.
// By targetting the markup directly we enable greater global styles compatibility.
// The extra container specificity is due to global styles outputting link styles that need overriding.
&.wp-block-navigation a {
// Inherit colors set by the block color definition.
// By adding low specificity, we enable compatibility with link colors set in theme.json,
// but still allow them to be overridden by user-set colors.
.wp-block-navigation-item__content {
color: inherit;
display: block;

// Set the default menu item padding to zero, to allow text-only buttons.
padding: 0;
}

// Force links to inherit text decoration applied to navigation block.
Expand Down Expand Up @@ -250,11 +252,6 @@
// That way if padding is set in theme.json, it still wins.
// https://css-tricks.com/almanac/selectors/w/where/

// Set the default menu item padding to zero, to allow text-only buttons.
.wp-block-navigation .wp-block-navigation-item__content {
padding: 0;
}

// When the menu has a background, items have paddings, reduce margins to compensate.
// Treat margins and paddings differently when the block has a background.
.wp-block-navigation:where(.has-background) a {
Expand Down