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

Feature/moose 66 update post content selector #117

Merged
merged 14 commits into from
Oct 31, 2023

Conversation

dpellenwood
Copy link
Collaborator

@dpellenwood dpellenwood commented Oct 27, 2023

What does this do/fix?

  • Adds a css class names to core paragraph and list blocks to make styling much easier to implement.
  • Simplifies paragraph, heading, and list styles to reduce selector complexity and make use of the above added CSS class.
  • Updates several instances of wp-site-blocks in css selectors to use the wp-block-post-content selector instead. The post-content should always appear in the editor and on the FE, so this single selector is a nice simplifier.
  • Comments out the our focus-visible reset style as it is bleeding into the editor. (Needs conversation)
  • Removes unnecessary block quote partial.

Ticket: MOOSE-66

Copy link
Contributor

@GeoffDusome GeoffDusome left a comment

Choose a reason for hiding this comment

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

🟢 This works for me! Thanks for tackling! 🌮

Copy link
Contributor

@GeoffDusome GeoffDusome left a comment

Choose a reason for hiding this comment

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

One thing I just noticed while pulling this over. May have to separate these due to postcss warnings.

Comment on lines +5 to +41
.wp-block-list {

&::marker {
font-weight: var(--font-weight-bold);
}
li ~ li {
margin-top: var(--spacer-30);
}

/* ----------------------------------------------------------------------
* CASE: Ordered List
* ---------------------------------------------------------------------- */

ol& {
padding-inline-start: 1.2rem;

li {
padding-inline-start: 10px;

& ~ li {
margin-top: var(--spacer-30);
&::marker {
font-weight: var(--font-weight-bold);
}
}
}
}

/* ----------------------------------------------------------------------
* Unordered List
*
* The first selector applies to the FE, the second in the editor.
* The list block is the only block on the FE that doesn't get a class,
* so we're able to apply a :not() selector for the class attribute.
* While both will apply in the editor, only the second will affect
* the actual list block.
* ---------------------------------------------------------------------- */

.wp-site-blocks ul:not([class]),
ul.wp-block-list {
padding-inline-start: 10px;

& li {
padding-inline-start: 1.3rem;
position: relative;

&::marker {
content: var(--icon-list-bullet);
transform: translateX(10px);
}
/* ----------------------------------------------------------------------
* CASE: Unordered List
* ---------------------------------------------------------------------- */

ul& {
padding-inline-start: 10px;

li {
padding-inline-start: 1.3rem;
position: relative;

& ~ li {
margin-top: var(--spacer-30);
&::marker {
content: var(--icon-list-bullet);
transform: translateX(10px);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@dpellenwood I'm getting some warnings in postcss when trying to use these styles due to the ul& and ol& not having a symbol to start:
postcss-nesting: Nested selectors must start with a symbol and "ul&" begins with a letter.

Copy link
Collaborator Author

@dpellenwood dpellenwood Oct 31, 2023

Choose a reason for hiding this comment

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

Interesting. I know that this was a later change to the spec, but it is valid now. (The second code example under this heading.) I think your project may not be using the latest version of postcss-preset-env or similar. That selector doesn't cause any errors here on Moose.

Copy link
Contributor

@ChrisMKindred ChrisMKindred left a comment

Choose a reason for hiding this comment

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

👍 Looks Good!

@dpellenwood dpellenwood merged commit f547f6a into main Oct 31, 2023
5 checks passed
@dpellenwood dpellenwood deleted the feature/MOOSE-66-update-post-content-selector branch October 31, 2023 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants