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

Styles: Elements and pseudo elements use different box sizing. #6513

Closed
2 tasks
peterwilsoncc opened this issue May 1, 2018 · 1 comment · Fixed by #7545
Closed
2 tasks

Styles: Elements and pseudo elements use different box sizing. #6513

peterwilsoncc opened this issue May 1, 2018 · 1 comment · Fixed by #7545
Labels
[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

@peterwilsoncc
Copy link
Contributor

Issue Overview

edit-post/assets/stylesheets/main.scss sets the box-sizing property with this rule set.

.gutenberg {
	* {
		box-sizing: border-box;
	}
}

This causes elements to have border-box sizing while pseudo elements (::before, ::after) use the browser default content-box.

Steps to Reproduce (for bugs)

See gif below.

  1. Start a new post in Gutenberg
  2. Add a block (list block used in gif below)
  3. In the inspector, select a pseudo element editor-block-list__block-edit::before to inspect styles. Box sizing will show content-box.
  4. Select the pseudo elements parent editor-block-list__block-edit to inspect styles. Box sizing will show border-box.

Expected Behavior

A consistent sizing method would be preferable.

Current Behavior

Sizing method is inconsistent.

Possible Solution

Two possibilities

.gutenberg {
	 box-sizing: border-box;

	&:before, &:after,
	*, *:before, *:after {
		box-sizing: inherit;
	}
}

or

.gutenberg {
	*, *:before, *:after {
		box-sizing: border-box;
	}
}

Either change will require visual regression testing.

Screenshots / Video

box-sizing

Related Issues and/or PRs

Todos

  • Tests
  • Documentation
@danielbachhuber danielbachhuber added [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 labels May 1, 2018
@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone May 1, 2018
@mtias mtias added Needs Design Feedback Needs general design feedback. and removed Design labels Jun 22, 2018
jasmussen added a commit that referenced this issue Jun 26, 2018
This PR tries to fix #6513.

In my testing, this has no adverse side-effects, but like the original ticket reporter suggests, we need to verify that there are no visual regressions. It would be good to test:

- metaboxes
- plugins
- all breakpoints
- browsers
- IE
@karmatosed
Copy link
Member

I am going to remove the design feedback label as this is a work in progress with a PR.

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Jul 5, 2018
aduth pushed a commit that referenced this issue Jul 18, 2018
This PR tries to fix #6513.

In my testing, this has no adverse side-effects, but like the original ticket reporter suggests, we need to verify that there are no visual regressions. It would be good to test:

- metaboxes
- plugins
- all breakpoints
- browsers
- IE
aduth pushed a commit that referenced this issue Jul 19, 2018
* Fix box sizing for pseudo elements.

This PR tries to fix #6513.

In my testing, this has no adverse side-effects, but like the original ticket reporter suggests, we need to verify that there are no visual regressions. It would be good to test:

- metaboxes
- plugins
- all breakpoints
- browsers
- IE

* Try an inherit method instead.

* Remove wildcard selector from meta-box box-sizing.

The child elements now inherit the container’s box-sizing rules.

* Remove `box-sizing: padding-box`.

Value removed from spec and depricated in Firefox 57.

* Remove obsolete box-sizing settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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

Successfully merging a pull request may close this issue.

4 participants