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

Alignment: blocks using alignment should apply data-align consistently #7908

Closed
designsimply opened this issue Jul 11, 2018 · 2 comments
Closed
Labels
[Feature] Blocks Overall functionality of blocks [Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.

Comments

@designsimply
Copy link
Member

Moved from #4010 h/t @bradyvercher.

Edit Wrapper Data Attribute

Most of the blocks apply a data-align attribute to the edit wrapper with the alignment value similar to this:

getEditWrapperProps( attributes ) {
    const { align } = attributes;
    if ( 'left' === align || 'right' === align || 'wide' === align || 'full' === align ) {
        return { 'data-align': align };
    }
}

Center aligning never seems to change the value of the data attribute for the edit wrapper despite it being a valid value for most blocks. It seems like this should be applied consistently in case themes treat aligncenter different than alignnone or an empty value.

@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks Needs Decision Needs a decision to be actionable or relevant labels Jul 11, 2018
@designsimply designsimply added the [Type] Code Quality Issues or PRs that relate to code quality label Jul 12, 2018
@tofumatt
Copy link
Member

Also, the fact that we write if ( 'left' === align || 'right' === align || 'wide' === align || 'full' === align ) { is quite repetitive; we should really be using a constant of allowed align values and checking against it.

@aduth
Copy link
Member

aduth commented Apr 22, 2019

I'd consider the root underlying issue here to be that blocks should not be implementing this alignment behavior themselves, but rather opting in to the common implementation (aligns support, also noted as "Common Block Functionality" in Roadmap).

Duplicate of #13780

@aduth aduth closed this as completed Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants