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

Navigation block: Can't style block in editor using theme CSS #18914

Closed
noisysocks opened this issue Dec 4, 2019 · 1 comment · Fixed by #18926
Closed

Navigation block: Can't style block in editor using theme CSS #18914

noisysocks opened this issue Dec 4, 2019 · 1 comment · Fixed by #18926
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@noisysocks
Copy link
Member

The Navigation block as it appears in the editor is using class names that do not match what is rendered on the frontend when the Navigation block is published in a page or post. This means that styling made to the Navigation block by a theme is not automatically picked up by the block editor.

Ideally, a block's editor.scss styles should build on top of a block's style.scss styles.

The markup of a Navigation block in the frontend—note the underlined class names:

Screen Shot 2019-12-04 at 16 25 11

The markup of a Navigation block in the editor—note the underlined class names:

Screen Shot 2019-12-04 at 16 31 36

There are two immediate problems:

  • Links in the editor should have the wp-block-navigation-item__link class but instead have wp-block-navigation-link.
  • Navigation items in the editor should have the wp-block-navigation-item class but do not.
@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Dec 4, 2019
@talldan talldan self-assigned this Dec 5, 2019
@talldan
Copy link
Contributor

talldan commented Dec 5, 2019

@noisysocks My understanding is that wp-block-navigation-link is the correct class name for the block since the block was renamed to Navigation Link. Ideally everywhere reflects that.

The classnames in the editor look correct to me. The element with the data-block attribute is the BlockEdit component which renders the output of the block's edit function. The first child of BlockEdit should have the wp-block-navigation-link class name, which it does.

The classnames in the frontend should be wp-block-navigation-link, so that definitely needs to be corrected.

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 [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants