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

Change BaseControl sibling selector to use margin-top #17985

Closed
wants to merge 1 commit into from

Conversation

chrisvanpatten
Copy link
Contributor

Description

Changes the BaseControl sibling selector to use margin-top instead of margin-bottom for consistent spacing. Fixes #17984.

How has this been tested?

Confirmed in CSS via web inspector and in local development environment.

Screenshots

Before:

Screen Shot 2019-10-16 at 9 30 05 PM Screen Shot 2019-10-16 at 9 30 56 PM

After:

Screen Shot 2019-10-16 at 9 32 33 PM Screen Shot 2019-10-16 at 9 32 39 PM

Types of changes

Small CSS bug fix.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@chrisvanpatten chrisvanpatten added [Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components labels Oct 17, 2019
@chrisvanpatten chrisvanpatten self-assigned this Oct 17, 2019
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested but this makes sense.

Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle, this seems fine.

However the sad thing with all small changes is, they're never small. This happens:

Screenshot 2019-10-17 at 10 34 36

Screenshot 2019-10-17 at 10 34 56

I imagine that some plugins rely on the current configuration as well, so this will probably need a dev note too.

Thank you for the PR! 🤟

@youknowriad youknowriad added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Oct 17, 2019
@ItsJonQ
Copy link

ItsJonQ commented Jan 21, 2020

👋 Hallooo!! Just checked out this PR.

In principle, this seems fine... However the sad thing with all small changes is, they're never small.

@jasmussen That's been my experience as well.

Assumed margin (top or bottom) via DOM order is normally okay for simpler use-cases. By simpler use cases, I mean when most sibling DOM element rendering is consistent or has only a handful of variation. For example, items that appear within a blog post.

However, for more app-like UI, it's very difficult to predict how/when elements may need to render above, below, or next to each other, with layout rules defined by display: flex, float, position, or anything in between.

@chrisvanpatten I really appreciate your intention + initiative here.

Changes the BaseControl sibling selector to use margin-top instead of margin-bottom for consistent spacing.

If I may, by "consistent spacing", I feel like you don't necessarily mean specific px values, but rather... the darn thing should look/work the same. Every time. So we never have to think about it again 😂

This is a long shot, but I think a good solution would be for margins to be defined explicitly - either by using a layout-based Component or ad-hoc - both using a predefined set of layout/spacing values (e.g. 4px, 8px, etc...). Of course, this would involve removing the margins for BaseControl, which will most likely also break a bunch of things 😛 .


As for this PR, I'm not sure how to proceed, as changing the margin from bottom to top solves some use cases, but has unintended side effects for others.

@chrisvanpatten
Copy link
Contributor Author

chrisvanpatten commented Jan 22, 2020

@ItsJonQ Thanks for taking a look!

If I may, by "consistent spacing", I feel like you don't necessarily mean specific px values, but rather... the darn thing should look/work the same.

Yes exactly. I’m less concerned with either actual size/value, and more concerned that spacing is treated consistently.

That said, I’ve obviously let this grow stale, and frankly that’s because I haven’t been totally confident in my solution for all the reasons you hit upon. It solves some cases but risks introducing other regressions. I also agree with what you hinted at — this is probably best addressed in a more holistic way, ideally at the component level.

So with that in mind I think I’ll close this PR, although I’m happy to also open an issue for discussion of this problem at a higher level. And if this solution seems like a viable path at a later point, we can always reopen or revisit.

@chrisvanpatten
Copy link
Contributor Author

chrisvanpatten commented Jan 22, 2020

I will also say, for posterity, that I believe the current behaviour is a mistake. Not a mistake of the “I disagree with this” variety, but I actually think it’s a genuine bug, introduced unintentionally.

Unfortunately, it’s a bug that we’ve come to depend on in certain circumstances. As a result, it’s tricky to fix, because the solution inevitably breaks the things which assumed the bug was intended behaviour 😅

@jorgefilipecosta jorgefilipecosta removed the Needs Dev Note Requires a developer note for a major WordPress release cycle label Feb 11, 2020
@aristath aristath deleted the fix/base-control-margin branch November 10, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect BaseControl margin
5 participants