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

Improve theme.json support for Navigation block #39052

Open
1 of 7 tasks
scruffian opened this issue Feb 24, 2022 · 17 comments
Open
1 of 7 tasks

Improve theme.json support for Navigation block #39052

scruffian opened this issue Feb 24, 2022 · 17 comments
Labels
[Block] Navigation Affects the Navigation Block [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@scruffian
Copy link
Contributor

scruffian commented Feb 24, 2022

What problem does this address?

There are many settings available to the navigation block which cannot be customized in theme.json. It is beneficial to themes to be able to style blocks via theme.json rather than in block settings, as it means themes can share patterns and simply modify the navigation via theme.json, rather than each theme needing to create its own header to adjust the navigation.

What is your proposed solution?

It is already possible to set colors and typography for the navigation block in theme.json, but the following properties would also be helpful:

This is list is a good starting point but we should anticipate other properties also being needed.

cc @getdave @draganescu

@scruffian scruffian added the [Block] Navigation Affects the Navigation Block label Feb 24, 2022
@priethor priethor added the [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. label Feb 24, 2022
@jasmussen
Copy link
Contributor

Excellent list, thank you! I would also add: overlay menu padding that potentially inherits from a smarter global padding (#35607), but is still individually configurable.

One consideration to keep in mind for the overlay menu properties is in case it becomes possible to edit the contents separately for total customization.

@getdave
Copy link
Contributor

getdave commented Feb 28, 2022

Worthing adding to #38275 ?

@scruffian
Copy link
Contributor Author

Worthing adding to #38275 ?

Yes please!

@Humanify-nl
Copy link

May I add here that currently the theme.json block settings for colors on the nav block are unresponsive. I would be nice if this works too!

{
    "settings": {
        "blocks": {
            "core/navigation": {
                "color": {
                    "text": false,
                    "background": false
                }
            }
        }
    }
}

@scruffian
Copy link
Contributor Author

What would you expect false to do in this context?

@Humanify-nl
Copy link

What would you expect false to do in this context?

To disable the color controls for the user in the block editor for this specific block.

Specifically, for theme authors who do not want to give color controls to users (clients) on the menu blocks.

It was my assumption that this table theme.json v2 - living reference will be applicable for all blocks (eventually).

image

@scruffian
Copy link
Contributor Author

It was my assumption that this table theme.json v2 - living reference will be applicable for all blocks (eventually).

I believe this is a correct assumption :)

@scruffian
Copy link
Contributor Author

We also should have a way to target the typography inside the overlay: #39352

I am starting to wonder if the overlay should be a separate block...

@Humanify-nl
Copy link

Humanify-nl commented Mar 10, 2022

I had some issues with the .has-background class that were coupled with the color styling of submenu background. It is a tad weird and confusing. Would give another possible argument for splitting these two (submenu and menu overlay)

Since I've been working this week on testing the menu block in my own starter theme, I've come upon some other 'theme.json for navigation' related here: #39263 , maybe relevant to your list.

@jasmussen
Copy link
Contributor

I am starting to wonder if the overlay should be a separate block...

Would that enable or simplify this?

@getdave
Copy link
Contributor

getdave commented Mar 15, 2022

I am starting to wonder if the overlay should be a separate block...

It should. I've been thinking about it as well.

@getdave
Copy link
Contributor

getdave commented May 16, 2022

It looks like the Nav block already has Gap support.

Screen Shot 2022-05-16 at 17 07 40

@scruffian
Copy link
Contributor Author

It looks like the #37543

The block does have support for blockGap, but it doesn't work in theme.json, see #39789

@tomdevisser
Copy link
Member

Was about to write an issue for the states when I saw this one! Would be great to have hover, active and visited states on these as they're links. Should be copy/paste-able from the link block. :)

@getdave getdave changed the title Navigation block: Improve theme.json support Improve theme.json support for Navigation block Mar 17, 2023
@getdave
Copy link
Contributor

getdave commented Mar 17, 2023

Related #44712

@aslamdoctor
Copy link

We also can not do this to style navigation, this is much needed

"styles": {
        "blocks": {
            "core/navigation": {
                "elements": {
                    "link": {
                        "color": {
                            "text": "red"
                        },
                        ":hover": {
                            "color": {
                                "text": "blue"
                            }
                        }
                    }
                }
            }
        }
}

@caseymilne
Copy link

We also can not do this to style navigation, this is much needed

"styles": {
        "blocks": {
            "core/navigation": {
                "elements": {
                    "link": {
                        "color": {
                            "text": "red"
                        },
                        ":hover": {
                            "color": {
                                "text": "blue"
                            }
                        }
                    }
                }
            }
        }
}

I found this isn't due to lack of support, but instead a bug where there is a "color: inherit" class that takes precedence... it's in a bug ticket somewhere here. In the meantime you can make it work by using !important:

"styles": {
		"blocks": {
			"core/navigation": {
				"elements": {
					"link": {
						":hover": {
							"color": {
								"text": "#8B6212 !important"
							}
						}
					}
				}
			}
		}
	}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

8 participants