Skip to content

Commit 3272099

Browse files
committed
Make color styles inherit
1 parent ff7247b commit 3272099

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

packages/block-library/src/navigation/style.scss

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ $navigation-sub-menu-width: $grid-unit-10 * 25;
146146
align-items: center;
147147
width: max-content;
148148
padding: $grid-unit-10 * 0.75 $grid-unit-10 * 2;
149+
150+
// Inherit colors from the parent nav block. Overrides some
151+
// default styling on `<a>` elements that sets the color to blue.
152+
color: inherit;
149153
}
150154

151155
// Submenu links only
@@ -196,28 +200,34 @@ $navigation-sub-menu-width: $grid-unit-10 * 25;
196200
.wp-block-navigation {
197201

198202
// Default / Light styles
199-
.wp-block-navigation-link,
200-
&.is-style-light .wp-block-navigation-link {
203+
&:not(.has-text-color) .wp-block-navigation-link,
204+
&:not(.has-text-color).is-style-light .wp-block-navigation-link {
201205
// No text color
202-
&:not(.has-text-color) > .wp-block-navigation__container {
206+
> .wp-block-navigation__container {
203207
color: $light-style-sub-menu-text-color;
204208
}
209+
}
205210

211+
// Default / Light styles
212+
&:not(.has-background) .wp-block-navigation-link,
213+
&:not(.has-background).is-style-light .wp-block-navigation-link {
206214
// No background color
207215
&:not(.has-background) > .wp-block-navigation__container {
208216
background-color: $light-style-sub-menu-background-color;
209217
}
210218
}
211219

212220
// Dark styles.
213-
&.is-style-dark .wp-block-navigation-link {
221+
&:not(.has-text-color).is-style-dark .wp-block-navigation-link {
214222
// No text color
215-
&:not(.has-text-color) > .wp-block-navigation__container {
223+
> .wp-block-navigation__container {
216224
color: $dark-style-sub-menu-text-color;
217225
}
226+
}
218227

228+
&:not(.has-background).is-style-dark .wp-block-navigation-link {
219229
// No background color
220-
&:not(.has-background) > .wp-block-navigation__container {
230+
> .wp-block-navigation__container {
221231
background-color: $dark-style-sub-menu-background-color;
222232
}
223233
}

0 commit comments

Comments
 (0)