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

Theme.json styling for image gets unexpected results for background and border #33794

Open
karmatosed opened this issue Jul 31, 2021 · 1 comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended

Comments

@karmatosed
Copy link
Member

karmatosed commented Jul 31, 2021

I am currently experiencing some unexpected results for border and background on the image block when using theme.json. The following is what I have set:

				"color":{
					"background": "currentColor"
				},
				"spacing": {
					"margin":{
						"bottom": "var(--wp--custom--margin--vertical-large)",
						"top": "var(--wp--custom--margin--vertical)"
					},
					"padding": {
						"bottom": "1px",
						"top": "1px",
						"right": "1px",
						"left": "1px"
					}
				}
			},

The result is:

image

Whilst this is a certain 'look', I don't really want that space at the bottom. I tried the above to get around the problem of no border working.

In addition to this, I find myself unable to set the border properties to the image block at all. It won't output. For example:

				"border": {
					"color": "currentColor",
					"style": "solid",
					"width": "1px 1px 1px 1px"
				}

This doesn't seem to work at all on image block when I output to the front. It works in the editor but doesn't on the front of my site.

I understand it might be something I am doing, but it seems there are also potentially 🐛 lurking in this.

@karmatosed karmatosed added the [Type] Bug An existing feature does not function as intended label Jul 31, 2021
@skorasaurus skorasaurus added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Jul 31, 2021
@glendaviesnz
Copy link
Contributor

glendaviesnz commented Aug 11, 2021

I think the main issue is that by default the border is being applied to the figure wrapping div and not the image.

There is some working being done here to get the border working correctly on the image for user selected border settings, and these are applied to the img tag so don't have the extra padding at the bottom:
Screen Shot 2021-08-11 at 12 01 50 PM

... but there is currently no way to specify in theme.json to target the border to an img element within the block instead of the block wrapper. There are some ongoing discussions about how this might be best handled:

@Thelmachido Thelmachido added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants