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

Navigation link CSS overrides defaults set using theme.json elements #31784

Closed
carolinan opened this issue May 13, 2021 · 2 comments · Fixed by #31878
Closed

Navigation link CSS overrides defaults set using theme.json elements #31784

carolinan opened this issue May 13, 2021 · 2 comments · Fixed by #31878
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

@carolinan
Copy link
Contributor

Description

I am trying to add a default padding to the navigation link block using theme.json, but the styles for the block overrides it.

Version 1, styles > blocks

"core/navigation-link": {
	"elements" : {
		"link": {
			"spacing": {
				"padding" : {
					"top" : ".5em",
					"right": "1em",
					"bottom": ".5em",
					"left": "1em"
				}
			}
		}
	}
},

CSS output:

.wp-block-navigation .wp-block-navigation-link .wp-block-navigation-link__content.wp-block-navigation-link__content.wp-block-navigation-link__content, .wp-block-navigation .wp-block-pages-list__item .wp-block-pages-list__item__link {
    padding: 0;
}

.wp-block-navigation-link a {
    padding-top: .5em;
    padding-right: 1em;
    padding-bottom: .5em;
    padding-left: 1em;
}

Step-by-step reproduction instructions

  1. Add the example code to theme.json.
  2. In either editor, add a navigation block with example links.
  3. See that the padding is overridden..

Expected behaviour

I expect the default in theme.json to work.

Actual behaviour

The padding is overridden.

WordPress information

  • WordPress version: 5,7.2
  • Gutenberg version: 10.6.0
  • Are all plugins except Gutenberg deactivated? yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome Version 90.0.4430.212
@carolinan carolinan added the [Type] Bug An existing feature does not function as intended label May 13, 2021
@Mamaduka Mamaduka added the [Block] Navigation Affects the Navigation Block label May 13, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 17, 2021
@jasmussen
Copy link
Contributor

I created #31878 to fix this one. It requires a bit of a refactor of the nav block CSS, which is ultimately good. But it needs careful testing.

Note that because of how the Page List block works, any navigation menus that use this block will not inherit these values. I will create a separate ticket for how we might address this.

@jasmussen
Copy link
Contributor

Created #31879 to track Page List changes, and https://core.trac.wordpress.org/ticket/53220#ticket for TT1.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants