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

Link and :hover styles in Navigation block being overridden by core block styles #62987

Open
bgardner opened this issue Jun 29, 2024 · 3 comments · May be fixed by #62992
Open

Link and :hover styles in Navigation block being overridden by core block styles #62987

bgardner opened this issue Jun 29, 2024 · 3 comments · May be fixed by #62992
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@bgardner
Copy link

bgardner commented Jun 29, 2024

Description

Likely a symptom similar to discussion at Core block styles are overriding theme.json styles in WordPress 6.6, the link and :hover styles for the Navigation block are being overridden by core block styles. This is a concerning trend, as this overriding is also happening at #62960 in addition to other blocks that have yet to be fixed (#62679 (comment)).

Here is the code from /wp-includes/blocks/navigation/style.min.css?ver=6.6-RC1 that is causing the override:

.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: inherit;
}

Here is the code it is overriding:

:root :where(.wp-block-navigation a:where(:not(.wp-element-button))) {
	color: var(--wp--preset--color--contrast);
}

Here is the code I have in the theme.json file seen below in the video

{
	"styles": {
		"blocks": {
			"core/navigation": {
				"elements": {
					"link": {
						"color": {
							"text": "var(--wp--preset--color--contrast)"
						},
						":hover": {
							"color": {
								"text": "var(--wp--preset--color--primary)"
							}
						}
					}
				}
			}
		}
	}
}

Step-by-step reproduction instructions

  1. Add code above into theme.json file.
  2. Hover links in Navigation block on front end.
  3. Witness theme.json style being overridden by core block style.

Screenshots, screen recording, code snippet

Screen.Recording.2024-06-28.at.9.09.52.PM.mp4

Environment info

WordPress 6.6 RC1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@bgardner bgardner added the [Type] Bug An existing feature does not function as intended label Jun 29, 2024
@bgardner bgardner changed the title Link and :Hover styles in Navigation block being overridden by core block styles Jun 29, 2024
@akasunil akasunil added the [Block] Navigation Affects the Navigation Block label Jun 29, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 29, 2024
@talldan
Copy link
Contributor

talldan commented Jul 1, 2024

@bgardner Thanks for creating the issue. @tellthemachines @andrewserong and I had a look into the issue, and it seems like this was also a bug in 6.5, and possibly going back further.

The navigation block has some issues around the way it implements color that are going to be challenging to solve in a backwards compatible way. I haven't been able to spot any 6.6 specific bugs though when comparing to 6.5.

Is the social icons issue you mentioned in the issue still one that needs to be fixed?

@talldan
Copy link
Contributor

talldan commented Jul 1, 2024

I found this was originally reported in #47431

Edit: I've also made a bug report for another issue I spotted while looking into this - Group block overrides Navigation Link hover color in the editor #63003.

@bgardner
Copy link
Author

bgardner commented Jul 1, 2024

@talldan Yes, as it stands, this issue and the issue with social icons as noted are the only two remaining instances of this overarching issue that I've been able to note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
4 participants