Modal dialogs clip content with certain viewport width

Created on 20 October 2023, about 1 year ago
Updated 14 March 2024, 9 months ago

Problem/Motivation

In modal dialogs content, including buttons and other interactive elements may be clipped out of view. Modal does not handle breakpoints properly.

Steps to reproduce

Example screenshots from latest Filed UI with Macbook with browser at about 50% and 60% widths where 50% triggers a breakpoint but about 51% to 75% clips content.


🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Javascript 

Last updated 3 days ago

Created by

🇫🇮Finland simohell

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @simohell
  • First commit to issue fork.
  • Merge request !5238Fix modal width → (Open) created by srishtiiee
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇫🇮Finland lauriii Finland

    Nice! I got first confused by this because jQuery UI has the maxWidth property, but reading the documentation and testing it manually, it doesn't look like it behaves the same as CSS max-width property. Even if a dialog uses the maxWidth property, it needs this bug fix for it to work on all breakpoints. 👍

    Can we add test coverage for this in \Drupal\FunctionalJavascriptTests\Dialog\DialogPositionTest?

  • Status changed to Needs review about 1 year ago
  • First commit to issue fork.
  • 🇺🇸United States smustgrave

    Question how often could a new character be added to php date?

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Did rebase so I could run the test-only feature

    There was 1 failure:
    1) Drupal\FunctionalJavascriptTests\Dialog\DialogPositionTest::testModalWidthResizing
    Failed asserting that 'position: fixed; height: auto; width: 880px; top: 263.319px; left: 0.003125px; z-index: 101;' contains "width: 745".
    /builds/issue/drupal-3395590/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
    /builds/issue/drupal-3395590/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
    /builds/issue/drupal-3395590/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php:94
    /builds/issue/drupal-3395590/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    FAILURES!
    Tests: 2, Assertions: 16, Failures: 1.
    

    Nice test case!

    Tested manually and got the same results as the IS.

  • Status changed to Needs work about 1 year ago
  • 🇫🇮Finland lauriii Finland

    Realized that we need to take into account displace offsets too

  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • 🇫🇮Finland lauriii Finland

    Testing the MR manually, I realized that we should not take into account the displace when the dialog is modal because modal would render on top of other elements. You can check if the dialog is modal from event.data.settings.modal. Maybe we could take that into account in the width calculation and open a follow-up to fix this for the height?

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Retested and still see the issue has been fixed. Didn't upload screenshots as the IS has them.

  • Status changed to Needs work about 1 year ago
  • 🇫🇮Finland lauriii Finland

    Added few comments in the MR

  • 🇷🇸Serbia finnsky

    Why we cannot use css max-width here?
    With combination with `calc` and `vw` and `--drupal-displace-offset-left/right`?

  • Merge request !5477CSS only fix - #3395590 → (Open) created by finnsky
  • 🇷🇸Serbia finnsky

    This fix is working.
    Can be also added

    max-width: calc(100vw - var(--drupal-displace-offset-left, 0) - var(--drupal-displace-offset-right, 0)) 
    

    for non modals. Ideally we need to simplify dialog js instead of make it more complicated.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

    Believe there is 1 thread unanswered. If I'm wrong can a comment be dropped on the thread.

  • Pipeline finished with Success
    about 1 year ago
    Total: 902s
    #56051
  • Pipeline finished with Success
    about 1 year ago
    Total: 7840s
    #56520
  • Pipeline finished with Failed
    about 1 year ago
    Total: 162s
    #56615
  • Pipeline finished with Success
    about 1 year ago
    Total: 666s
    #56616
  • Pipeline finished with Failed
    about 1 year ago
    Total: 656s
    #57080
  • Is the test coverage enough for testing the changes that we implemented.Is it worth adding a test coverage testing the width of a non modal dialog which takes the offset into account as well?

  • Pipeline finished with Failed
    about 1 year ago
    #57087
  • Pipeline finished with Success
    about 1 year ago
    Total: 574s
    #57115
  • Status changed to Needs review about 1 year ago
  • Pipeline finished with Failed
    about 1 year ago
    Total: 3785s
    #58731
  • Pipeline finished with Failed
    about 1 year ago
    Total: 605s
    #58805
  • Pipeline finished with Failed
    about 1 year ago
    #58831
  • Seems like a random test failure related to chromedriver version.

  • Pipeline finished with Canceled
    about 1 year ago
    Total: 31s
    #59215
  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Believe feedback has been addressed, and issue appears to still be resolved followed same steps as before.

  • Pipeline finished with Failed
    about 1 year ago
    #59216
  • Pipeline finished with Failed
    about 1 year ago
    Total: 659s
    #60789
  • Status changed to Needs work about 1 year ago
  • There were test failures related to off-canvas modals so i have fixed those.So marking it needs work until everything is green.

  • Pipeline finished with Success
    about 1 year ago
    Total: 660s
    #60795
  • Status changed to Needs review about 1 year ago
  • The test are passing to marking it as NR.

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Could of sworn tests were green but update didn't break anything.

  • Status changed to Needs work about 1 year ago
  • 🇮🇳India omkar.podey

    Works as expected, good work 🎉 , tested manually, have some questions about the test and some nits.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 659s
    #64026
  • Pipeline finished with Success
    about 1 year ago
    Total: 829s
    #64039
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇮🇳India kunal.sachdev

    Have some suggestions regarding the documentation otherwise looks good to me.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇷🇸Serbia finnsky

    Added couple of feedback. Not strict but can you review please?

  • Pipeline finished with Success
    about 1 year ago
    Total: 689s
    #65766
  • Pipeline finished with Success
    about 1 year ago
    Total: 528s
    #66064
  • Pipeline finished with Success
    10 months ago
    Total: 533s
    #116984
  • Pipeline finished with Success
    10 months ago
    Total: 573s
    #116999
  • Status changed to Needs review 10 months ago
  • Status changed to Needs work 9 months ago
Production build 0.71.5 2024