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

Nav block: link text color inheritance fixes and tests #51710

Merged
merged 66 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
d7587f4
tests and fix for link color inheritance
MaggieCabrera Jun 20, 2023
7d1c89d
test agains emptytheme too, refactor setup, added better comments
MaggieCabrera Jun 21, 2023
4fcc62c
change setup for tests
MaggieCabrera Jun 28, 2023
830a356
removed inherit color for the moment on the block
MaggieCabrera Jun 28, 2023
489f2a4
finished the first test with all cases
MaggieCabrera Jun 30, 2023
e419f4f
finished second test
MaggieCabrera Jun 30, 2023
798a886
finished third test
MaggieCabrera Jun 30, 2023
1f5e5f2
started the last test
MaggieCabrera Jun 30, 2023
1b65241
spacing on comments
MaggieCabrera Jul 4, 2023
c5c6778
removed unnecessary actions from before/after testing functions
MaggieCabrera Jul 4, 2023
1c772ab
insert specific id of nav directly to speed up things
MaggieCabrera Jul 4, 2023
307123f
finish checking colors in the editor on desktop
MaggieCabrera Jul 4, 2023
186338a
test the overlay and reset settings
MaggieCabrera Jul 4, 2023
1f1fd9e
use variables for colors, cover rest of the cases to test
MaggieCabrera Jul 5, 2023
ce5a726
introduced a third link to cover non submenu links
MaggieCabrera Jul 5, 2023
53c8461
undo unwanted change
MaggieCabrera Jul 5, 2023
d737271
finish the overlay background tests and fix issues with inheritance
MaggieCabrera Jul 5, 2023
eb194a1
turn colors into variables for readibility
MaggieCabrera Jul 6, 2023
5f50ed5
fix wrong color syntax
MaggieCabrera Jul 6, 2023
eec98d1
Create test page before creating navigation menu
jeryj Jul 6, 2023
77d3df0
Add test coverage for selecting group text color that should be inher…
jeryj Jul 6, 2023
7d90814
Fix incorrect selector structure.
jeryj Jul 7, 2023
a436cd3
Update tests to check for black text defaults on navigation links
jeryj Jul 7, 2023
ce82292
Big refactor of navigation color tests
jeryj Jul 7, 2023
4541b41
Revert link color settings changing the navigation link colors
jeryj Jul 7, 2023
65ea6ca
Large refactor of navigation color tests
jeryj Jul 11, 2023
0f6473c
Add test for navigation background colors
jeryj Jul 11, 2023
42086c5
Add test to ensure navigation text does not inherit link color from t…
jeryj Jul 11, 2023
1a3c0b3
Only set default navigation submenu and overlay text colors if no nav…
jeryj Jul 11, 2023
e7c72ed
Have li navigation items inherit background color so it can be inheri…
jeryj Jul 12, 2023
8f27fd3
Change how to test editor mobile overlay colors
jeryj Jul 12, 2023
c693611
Move navigation color tests to own file
jeryj Jul 12, 2023
db21c63
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
ada037c
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
8786a7c
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
3131a7d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
680072d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
716d992
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
e726585
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
e49f423
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
ffc6806
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
57fe3b1
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
6988f59
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
1bdd9aa
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
05927a0
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
50113d2
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
53c4d8d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
c5e10fd
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
83d168c
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
6a80a1b
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
6b3710d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
2115868
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
b1a9724
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
92f289d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
ca77108
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
299c028
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
3a261f7
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
4c111b9
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
27a1694
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
ff5be80
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
f1e0f3d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
f10b86a
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
cfb8266
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
2aa309d
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
6a0cc47
update comments
scruffian Jul 13, 2023
1b66e92
Update test/e2e/specs/editor/blocks/navigation-colors.spec.js
scruffian Jul 13, 2023
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
9 changes: 0 additions & 9 deletions packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,6 @@
"type": "flex"
}
},
"__experimentalStyle": {
"elements": {
"link": {
"color": {
"text": "inherit"
}
}
}
},
"interactivity": true
},
"viewScript": "file:./view.min.js",
Expand Down
35 changes: 27 additions & 8 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $navigation-icon-size: 24px;

// Menu item container.
.wp-block-navigation-item {
background-color: inherit;
display: flex;
align-items: center;
position: relative;
Expand Down Expand Up @@ -398,15 +399,26 @@ button.wp-block-navigation-item__content {
}

// Default background and font color.
.wp-block-navigation:not(.has-background) {
.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-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: #fff;
border: 1px solid rgba(0, 0, 0, 0.15);
}

// If we do have a background color selected, inherit it from the navigation block
.wp-block-navigation.has-background {
.wp-block-navigation__submenu-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: #fff;
background-color: inherit;
}
}

.wp-block-navigation:not(.has-text-color) {
.wp-block-navigation__submenu-container {
// Set a default color for submenu text if none is selected
color: #000;
border: 1px solid rgba(0, 0, 0, 0.15);
}
}

Expand Down Expand Up @@ -458,7 +470,8 @@ button.wp-block-navigation-item__content {
right: 0;
bottom: 0;

.wp-block-navigation-link a {
// Low specificity so that themes can override.
& :where(.wp-block-navigation-item a) {
color: inherit;
}

Expand Down Expand Up @@ -579,6 +592,7 @@ button.wp-block-navigation-item__content {
// Remove background colors for items inside the overlay menu.
// Has to be !important to override global styles.
.wp-block-navigation-item .wp-block-navigation__submenu-container,
.wp-block-navigation__container,
.wp-block-navigation-item,
.wp-block-page-list {
color: inherit !important;
Expand Down Expand Up @@ -620,9 +634,14 @@ button.wp-block-navigation-item__content {
.wp-block-navigation:not(.has-background)
.wp-block-navigation__responsive-container.is-menu-open {
background-color: #fff;
}

.wp-block-navigation:not(.has-text-color)
.wp-block-navigation__responsive-container.is-menu-open {
color: #000;
}


// Overlay menu toggle button label
.wp-block-navigation__toggle_button_label {
font-size: 1rem;
Expand Down
Loading
Loading