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

Feature: Add classname to the div inside components-modal__content after the components-modal__header div #68920

Conversation

Debarghya-Banerjee
Copy link

@Debarghya-Banerjee Debarghya-Banerjee commented Jan 28, 2025

What?

This PR adds a new classname, components-modal__body, to the div immediately following components-modal__header inside the components-modal__content of the Modal component.

Why?

Currently, the Modal component lacks a specific classname for the div directly after the components-modal__header. This absence forces developers to make extra efforts to target the div, often requiring unnecessarily high CSS specificity. This not only complicates styling but also increases the likelihood of conflicts. By adding the components-modal__body classname, this change:

  • Maintains consistency with other modal elements by following a structured naming convention.

  • Separates the header from the body, improving the modularity of the modal structure.

  • Reduces unnecessary specificity, making it easier for developers to target and style the modal body cleanly and efficiently.

How?

The implementation introduces a components-modal__body classname to the div after the components-modal__header within the Modal component. This classname adheres to Gutenberg’s naming standards, ensuring backward compatibility and providing a clean separation between the header and body sections of the modal.

Testing Instructions

  • Open the Block Editor in WordPress.

  • Click on the Block Inserter (the "+" button in the editor toolbar).

  • Navigate to the Patterns tab.

  • Click on Explore all patterns to open the modal.

  • Inspect the modal structure using browser developer tools.

  • Verify that the div following components-modal__header now includes the components-modal__body classname.

Screenshots or screencast

Before

Screenshot 2025-01-28 at 3 31 15 PM

After

Screenshot 2025-01-28 at 3 40 18 PM

Issue

Closes #68918

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Debarghya-Banerjee <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Debarghya-Banerjee Debarghya-Banerjee changed the title Feature: Add classname to the div inside components-modal__content after the components-modal__header div Feature: Add classname to the div inside components-modal__content after the components-modal__header div Jan 28, 2025
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Debarghya-Banerjee! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 28, 2025
@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Jan 28, 2025
@t-hamano t-hamano self-requested a review January 29, 2025 11:08
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Debarghya-Banerjee Thanks for the PR!

We discussed whether this div needed a CSS class name. As a result, we decided not to add a CSS class name to this modal v1. See #68918 for details of that discussion.

I would like to close this PR, but thank you for your contribution.

@t-hamano t-hamano closed this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components Modal: Add Missing Classname to Div Inside components-modal__content After components-modal__header
3 participants