Feature: Add classname to the div inside components-modal__content
after the components-modal__header
div
#68920
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR adds a new classname,
components-modal__body
, to the div immediately followingcomponents-modal__header
inside thecomponents-modal__content
of theModal
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
After
Issue
Closes #68918