Skip to content

Cap modal width to the viewport at narrow screens - #53089

Open
ShreyashAgare26 wants to merge 1 commit into
fleetdm:mainfrom
ShreyashAgare26:fix-52811-modal-max-width
Open

Cap modal width to the viewport at narrow screens#53089
ShreyashAgare26 wants to merge 1 commit into
fleetdm:mainfrom
ShreyashAgare26:fix-52811-modal-max-width

Conversation

@ShreyashAgare26

@ShreyashAgare26 ShreyashAgare26 commented Sep 12, 2026

Copy link
Copy Markdown

Related issue: Resolves #52811

The modal sizes in Modal/_styles.scss are fixed pixels (650, 800, 850) and nothing stops them, so at a 768px window a large modal is still 800px wide and hangs off both sides.

I gave the container a max-width of the window minus 24px on each side. That covers all three sizes, not just the software details modal. Bigger windows see no change.

That leaves 640px of room inside the modal at 768px, which is a bit tight for the Add hosts tabs, so "iOS & iPadOS" was splitting over two lines. Tabs in modals now stay on one line each and the row wraps if it has to. Tabs on regular pages are the same as before.

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests

It is a CSS change and Jest does not read stylesheets, so there is nothing useful to assert in a unit test and no visual regression setup here. I ran the suites around it instead (components/Modal, components/TabNav, components/AddHostsModal, software modals): 44 tests passing. make lint-js is clean.

  • QA'd all new/changed functionality manually

At 768px, the modal from the issue used to sit from -16 to 784. Now it sits from 24 to 744, so 720px wide with both edges visible. The page never scrolls sideways either way.

I also opened the Add hosts modal at 768px (same position, tabs all on one line now), checked nothing inside either modal overflows, and compared tab rows on Dashboard, Software, Controls and Settings at 768px and 1440px against the current behavior. They measure the same.

AI

AI: Claude Code (claude-opus-5)

Frontend

  • Attached a screenshot or screen recording of each user-visible change. For changes to existing UI, show the before and after.

Software details modal at 768px.

Before

Software details modal at 768px before the fix, edges cut off

After

Software details modal at 768px after the fix, fits the window

@ShreyashAgare26
ShreyashAgare26 requested a review from a team as a code owner September 12, 2026 05:12
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6fba1f02-4973-4c6d-adb7-f558de86fc63

📥 Commits

Reviewing files that changed from the base of the PR and between 6ab4d9c and a6f8148.

📒 Files selected for processing (2)
  • changes/52811-modal-max-width
  • frontend/components/Modal/_styles.scss

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

Modal containers now use a viewport-based maximum width with side padding. Modal tab lists can wrap and resize vertically, while tab labels remain on one line. A changelog entry documents the fix for modals being clipped at 768px viewport widths.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a6f81

The responsive modal changes meet the stated objective and are ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #52811 requires the software details modal to fit at the 768px minimum viewport. frontend/components/Modal/_styles.scss adds max-width: calc(100vw - #{$pad-large} * 2) to the modal container…
Out of Scope Changes check ✅ Passed The modal tab rules support the width fix because capped modal content can make tab rows wrap incorrectly. The selector scopes these rules to tabs inside modal containers, so regular page tab rows rem…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Title check ✅ Passed The title clearly and concisely describes the primary change: limiting modal width to the viewport on narrow screens.
Description check ✅ Passed The description identifies the related issue, explains the implementation and user impact, documents testing and manual QA, includes the required AI section, and provides before-and-after frontend scr…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.05%. Comparing base (0e7747b) to head (a6f8148).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #53089    +/-   ##
========================================
  Coverage   76.05%   76.05%            
========================================
  Files        4122     4122            
  Lines      249833   249833            
  Branches    14443    14284   -159     
========================================
  Hits       190017   190017            
- Misses      59638    59639     +1     
+ Partials      178      177     -1     
Flag Coverage Δ
frontend 68.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ShreyashAgare26
ShreyashAgare26 force-pushed the fix-52811-modal-max-width branch 2 times, most recently from a2d364f to ba595e3 Compare September 12, 2026 05:29
Modal containers use fixed pixel widths (650/800/850px) with no max-width,
so at the narrowest supported viewport (768px) large and xlarge modals
render wider than the window with their edges and padding off-screen.

Cap every modal at the window minus a 24px gutter per side. That leaves
640px of content, which is too narrow for a full tab row, so tabs inside
modals now keep their labels on one line and wrap to a second row instead
of squeezing "iOS & iPadOS" mid-phrase.
@ShreyashAgare26
ShreyashAgare26 force-pushed the fix-52811-modal-max-width branch from ba595e3 to 4e99e19 Compare September 12, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

My device: software details modal is wider than the window at 768px

1 participant