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

Archeo: Fix nav block blockGaps values #5671

Merged
merged 1 commit into from
Mar 21, 2022
Merged

Conversation

mikachan
Copy link
Member

Changes proposed in this Pull Request:

This PR changes the blockGap values in the header and footer templates from var(--wp--custom--spacing--small) to2.5rem.

We've only recently changed to the variable in this PR #5640, however, I can't see this working locally anymore and I don't think this is working on dotcom. The rem value seems to work consistently both locally and on dotcom. Here's what it looks like:

Footer nav at 400px:
image

Footer nav at 1200px:
image

Header nav at 1200px:
image

Related issues:

Probably related to #5632

@mikachan mikachan added the [Theme] Archeo Automatically generated label for Archeo. label Mar 16, 2022
@mikachan mikachan added this to the Archeo milestone Mar 16, 2022
@mikachan mikachan requested a review from a team March 16, 2022 12:13
@mikachan mikachan self-assigned this Mar 16, 2022
@mikachan mikachan requested a review from kjellr March 16, 2022 12:15
Copy link
Contributor

@jffng jffng left a comment

Choose a reason for hiding this comment

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

This is strange. So at one point a variable value worked for blockGap?

I've been thinking about variables in patterns recently and more generally. I think whenever we provide a custom value in a pattern or template, we should provide a fallback value as well. I think that will help down the line when we want to add some of these patterns to the directory, and when custom templates and parts are preserved on theme switch.

That said, adding a fallback value (e.g. var(--wp--custom--spacing--small, 2.5rem)) doesn't work here either. Maybe worth reporting a bug upstream to investigate why?

@@ -9,7 +9,7 @@
'content' => '<!-- wp:group {"layout":{"inherit":"true"}} -->
<div class="wp-block-group"><!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between"},"style":{"spacing":{"padding":{"bottom":"var(--wp--custom--spacing--medium)","top":"var(--wp--custom--spacing--medium)"}}}} -->
<div class="wp-block-group alignwide" style="padding-top: var(--wp--custom--spacing--medium); padding-bottom: var(--wp--custom--spacing--medium);">
<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"left"},"overlayMenu":"never","className":"site-footer","style":{"typography":{"fontStyle":"normal"},"spacing":{"blockGap":"var(--wp--custom--spacing--small)"}},"fontSize":"small"} /-->
<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"left"},"overlayMenu":"never","className":"site-footer","style":{"typography":{"fontStyle":"normal"},"spacing":{"blockGap":"2.5rem"}},"fontSize":"small"} /-->
Copy link
Contributor

Choose a reason for hiding this comment

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

I also tested with the clamp(20px, 4vw, 40px) value and it doesn't work either.

@mikachan
Copy link
Member Author

Thanks for taking a look, I was worried it was just my environment!

So at one point a variable value worked for blockGap?

Yes, I'm sure this was working last week when we were working on this PR #5640, but now I'm wondering if I'd messed up my GB environment whilst working on it.. (and it was incorrectly working for me)

I really like the idea of adding a fallback value when we use variables, that makes a lot of sense.

I did take a look at GB issues/changes, it looks like support for blockGap had been removed for the Navigation block and then more recently added back in, but I think variable support was removed completely. I'm not sure I'm understanding the changes correctly though, so spending some time with them now. Here are some relevant links (I think):

@jffng
Copy link
Contributor

jffng commented Mar 16, 2022

I see, thanks for the context!

I wonder if it has to do with the sanitization for the blockGap attribute, since both clamp and var do not work.

@scruffian
Copy link
Member

I think it doesn't work at the moment and you have to use CSS :(

I played with it a bit here: WordPress/wordpress-develop#2307

@mikachan
Copy link
Member Author

I wonder if it has to do with the sanitization for the blockGap attribute, since both clamp and var do not work.

Yeah I think it could be something like this.

I think it doesn't work at the moment and you have to use CSS :(

Ah OK, thanks for confirming.

Hmm, should we pick a value that works in the markup (like the 2.5rem) or add some CSS so we can still use var(--wp--custom--spacing--small)?

@jffng
Copy link
Contributor

jffng commented Mar 16, 2022

I think it doesn't work at the moment and you have to use CSS :(

But why does it work when we supply a non-dynamic value like rem and px for the blockGap attribute?

Hmm, should we pick a value that works in the markup (like the 2.5rem) or add some CSS so we can still use var(--wp--custom--spacing--small)?

I think the baked value approach is preferable. So this PR LGTM as long as @kjellr is okay with the 2.5rem value used.

@scruffian
Copy link
Member

Oh I wasn't aware of that. Would you mind opening an issue for it?

@jffng
Copy link
Contributor

jffng commented Mar 18, 2022

Oh I wasn't aware of that. Would you mind opening an issue for it?

Done here: WordPress/gutenberg#39583

@kjellr
Copy link
Contributor

kjellr commented Mar 21, 2022

This looks good. It appears that the spacing I implemented in 63f02df has been lost at some point, so I'm going to open a quick followup PR to fix that.

@mikachan mikachan merged commit 6702d7b into trunk Mar 21, 2022
@mikachan mikachan deleted the archeo/fix-nav-blockgap branch March 21, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Theme] Archeo Automatically generated label for Archeo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants