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

Quote Block text alignment conflicts with added position alignment support #34454

Open
2 tasks done
grappler opened this issue Sep 1, 2021 · 3 comments
Open
2 tasks done
Labels
[Block] Quote Affects the Quote Block [Type] Enhancement A suggestion for improvement.

Comments

@grappler
Copy link
Member

grappler commented Sep 1, 2021

Description

I have added align support to the quote block. The code that I used can be found below.

This conflicts with the align attribute in the quote block which is used for text alignment with the block.

I would have expected for the attribute to be named textAlign instead of align.

Step-by-step reproduction instructions

  1. Add align support to quote block
import { addFilter } from '@wordpress/hooks';
const enableAlignmentOnBlocks = [  'core/quote' ];
// Add alignments to group block.
const addAlignmentToBlocks = ( settings, name ) => {
	if ( ! enableAlignmentOnBlocks.includes( name ) ) {
		return settings;
	}

	return {
		...settings,
		supports: {
			...settings.supports,
			align: [ 'left', 'center', 'right' ],
		},
	};
};
addFilter( 'blocks.registerBlockType', 'mcs-blocks/alignments/group-block', addAlignmentToBlocks );
  1. Add the quote pattern
  2. Get an error "Block validation: Block validation failed for core/quote" and changing the alignment changes both the position and text alignment

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 5.8/5.7.2

Pre-checks

  • I have searched the existing issues.
  • I have tested with all plugins deactivated except Gutenberg.
@grappler grappler changed the title Quote Block text alignment conflicts with add position alignment suport Quote Block text alignment conflicts with added position alignment support Sep 1, 2021
@youknowriad
Copy link
Contributor

Indeed, I'm not sure that the Quote block is the only one in this situation. This is unfortunately "historic". Meaning when these attributes were added, block supports didn't exist yet and they evolved organically after that. We could consider renaming the existing attribute which would require a deprecated version I think. We may have to check what other blocks do the same.

@youknowriad youknowriad added the [Block] Quote Affects the Quote Block label Sep 1, 2021
@carolinan carolinan self-assigned this Aug 3, 2022
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 14, 2023
@ellatrix
Copy link
Member

Cc @t-hamano

@t-hamano
Copy link
Contributor

The current align attribute, which actually means text alignment, needs to be migrated to the new textAlign block support.

Tracking Issue: #60763

The new textAlign block support should no longer conflict with the align block support, since it's saved as a style instead of an attribute.

But we need to first resolve the style override issue that this PR attempts to address: #62260

@carolinan carolinan removed their assignment Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Quote Affects the Quote Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants