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

Add margin block support to Site Title #31728

Merged

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented May 11, 2021

Description

Part of #23228

Adds the margin block support to the Site Title block.

How has this been tested?

Manually.

  1. Using a blocks theme such as Twenty Twenty-One Blocks, update the theme.json to enable margin support under the defaults or the core/site-title context:
                "spacing": {
			"customPadding": true,
			"customMargin": true,
			"units": [
				"px",
				"em",
				"rem",
				"vh",
				"vw"
			]
		},
  1. Open the site editor, and select the Site Title block.
  2. Open the Settings sidebar and expand the spacing settings panel in the inspector controls sidebar.
  3. Verify that the controls for both Padding and Margin are present.
  4. Modify the block's margins and verify that it looks as expected.
  5. Save the post and view on the frontend, confirming the Site Title displays correctly.

Screenshots

Screen Capture on 2021-05-11 at 14-32-44

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@stacimc stacimc requested a review from ajitbohra as a code owner May 11, 2021 21:35
@aaronrobertshaw aaronrobertshaw self-requested a review May 12, 2021 03:02
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw 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 as advertised in the Site Editor.

The Site Title block can also be added within a normal post in the block editor. In that scenario, it might catch people off guard that if not nested within another block the left/right margins are ignored due to !important styles added via the layout block support.

That said, I believe this can be merged. If the situation I mentioned becomes an issue we could look to extend the spacing support to allow different sides config when used as a "top level" block.

@aaronrobertshaw aaronrobertshaw merged commit d3ba19b into WordPress:trunk May 12, 2021
@github-actions github-actions bot added this to the Gutenberg 10.7 milestone May 12, 2021
@carolinan carolinan mentioned this pull request May 12, 2021
13 tasks
@stacimc stacimc deleted the add/margin-support-to-site-title branch May 12, 2021 15:39
@carolinan carolinan added the [Block] Site Title Affects the Site Title Block label Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Site Title Affects the Site Title Block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants