fix(modal): add padding-inline-end to prevent title overlapping close button - #8586
sanskruti-2122 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe modal title now uses configurable inline-end padding with a ChangesModal title spacing
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to Modal titles now reserve space for the close button, preventing long text from overlapping it. The focused styling change is ready to merge. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/deploy-preview |
|
Preview: https://pf-pr-8586.surge.sh |
There was a problem hiding this comment.
Thanks for taking a look! The issue is actually with the close button overlapping the content below. And looks like the issue is due to different implementations in our HTML/CSS modal component and our react modal component.
In the screenshots below, I've drawn a red outline around the header element and the close button.
Here is the HTML/CSS modal - looks OK. Close button is within the header, and aligns with the title text.
Here is the react modal. You can see the close button is outside of the header and not aligned with the title text.
And this is the react scrolling modal.
The difference is that the HTML/CSS component wraps the header contents in .pf-v6-c-modal-box__header-main which provides top padding of 8px, and the react component does not. That extra 8px pushes the header contents (title) down a little more and aligns it next to the close button better.
Ideally we would update the react component to add .pf-v6-c-modal-box__header-main inside of the header, wrapping the title, but we can't do that since that class is display: flex. Since users can pass whatever they want as the contents of the modal header, if they passed 2 or 3 elements as children, those would no longer display as they do naturally and would display as flex children instead. And that could be a breaking change for users.
Instead, we could update --#{$modal-box}__header-main--PaddingBlockStart to "0", and update --#{$modal-box}__header--PaddingBlockStart to calc(var(--pf-t--global--spacer--lg) + var(--pf-t--global--spacer--control--vertical--plain)) - effectively taking the padding off of .pf-v6-c-modal-box__header-main and adding it to .pf-v6-c-modal-box__header.
This Pull Request fixes a layout bug where long modal header titles would bleed past their container and overlap with the "X" close button in the top-right corner.
Changes
src/patternfly/components/ModalBox/modal-box.scssinside the.#{$modal-box}__titleclass.padding-inline-end: var(--#{$modal-box}__title--PaddingInlineEnd, 3rem);to reserve a clean buffer space on the right, ensuring the title text never touches or overlaps the close button.Related Issue
Fixes #8576
Summary by CodeRabbit