-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components Modal: Add Missing Classname to Div Inside components-modal__content
After components-modal__header
#68918
Comments
Regardless of whether this particular omission was intentional, we're moving towards a direction where internal elements of components will not have stable classnames for consumer style overrides at all. Internal DOM structure is not part of the backward compatibility guarantee, which makes style overrides like this fragile, so we've always been recommending against it. @Debarghya-Banerjee Is there a specific kind of style customization or targeting you want here that can't be achieved through For example, approaches like |
Hi @mirka , Thanks for replying, TBH, I was building something using the Modal component and I wanted to target that div, though targeting it ain't a tough job and can be done using children or nth-child, I was considering if we could have a classname similar to that for the header section. |
The question is whether there are legitimate use cases where the component's internal div needs to be targeted, instead of a |
When I was developing some plugins, I thought it would be useful to have a class like One use case is when we want the modal body to expand to 100% height and make some of its children scrollable. Take the core Classic block as an example. This block does not want to use scrolling of the modal content itself because tinyMCE itself is scrollable: |
@t-hamano Good example, thanks. We should make sure this kind of layout is more easily achieved in the v2 component. No strong opinion on whether we should add a classname there to the v1 component. It definitely solves an immediate problem, but also adds more things we need to think about when making changes to the component. |
Agree with @mirka . Classnames and internal DOM structure are not part of Having said that, you're both highlighting a shortcoming of the current component that is not easily addressable (if not by adding "one more prop"), and considering that the component is already heavily used in a hacky way, I don't think it would make a huge difference to add this extra classname 🙈 . This of course won't change the fact that consumers shouldn't rely on it and it's their responsibility to make sure that their "hack" doesn't break the UI when the library is updated. |
If the Modal v2 is planned and use cases like this are considered in the v2 component, I don't think it's necessary to add the class name to the Modal v1. I discovered that this div had a CSS class in the past that was subsequently removed (#50655). Considering this, adding the CSS class again might not be the best idea. Developers who do want to target this div can use the |
Thanks, everyone, for the insightful conversation. Based on it, I think we can close the issue and associated PR. While not perfect, it's possible to target the "body" div. Is there a tracking issue for Modal v2? It would be a good idea to mention this proposal there. |
Let's close this issue and the associated PR. I was not able to find any issues related to Modal v2, but if anyone knows of any please link them here. |
We had started the conversation in this discussion |
What problem does this address?
What is your proposed solution?
Screenshot
The text was updated successfully, but these errors were encountered: