Problem/Motivation

Modal dialogs does not good on small screens. They have different behaviors depending where they are, but some problems we haver are:

* On *admin/structure/block*, modal appears on edit disabled blocks. The width of the modal window is fixed by JS, so on smaller windows we lost a part of the modal.
* On *admin/structure/views/view/content*. The width on the modal window is fixed to 50%, and the left positions i calculated on resize. Maybe we could use this margin for the modal itself.
Views modal
Views modal

Proposed resolution

Modal dialog should have a common behavior on all its appearances in mobile devices / small screens.

Comments

ckrina’s picture

Issue summary: View changes
sqndr’s picture

The screenshots are taken with the patch from #2113911 applied to it. Just a notice. Problem also occurs without the patch.

sqndr’s picture

Related issues: +#2113911: Modal style update
ckrina’s picture

Added a patch to solve that problem that will apply on all .ui-dialog adding max-width and min-width on small devices:

.ui-dialog {
+    max-width: 92%;
+    min-width: 92%;
+  }

Important: This patch needs to be applied after the parent issue #2113911 patch 2113911-modal-style-22.patch because the file core/misc/dialog.theme.css is moved to core/themes/seven/dialog.theme.css.

ckrina’s picture

ckrina’s picture

Status: Active » Needs review

Ready for some test, updating status.

The last submitted patch, 4: 2225349-modal-style-responsive-4.patch, failed testing.

ckrina’s picture

StatusFileSize
new402 bytes

Removed min-width because I don't see it necessary, and adapted the patch to the current d8 branch to pass the test.

Bojhan’s picture

Issue tags: +frontend

Is there any reason there is soo much space on the left/right?

Bojhan’s picture

Status: Needs review » Needs work
Bojhan’s picture

Issue tags: +Novice
merilainen’s picture

Status: Needs work » Needs review
StatusFileSize
new886 bytes
new74.57 KB

Before you bash me completely for using !important, let me explain myself.
The popup gets a default width: 700 from core/modules/block/src/BlockListBuilder.php and core/modules/config/src/Form/ConfigSys.php, which makes it impossible to change it in css without !important. Removing those default values in mentioned files leads to the dialog getting a default width: 300 from core/assets/vendor/jquery.ui/ui/jquery.ui.dialog.js, which I presume is not to be altered. Using width:auto or width: "92%" in the php files means that the dialog gets very big in wider displays. Hence the !important, yuck.
Attached after.png.

lewisnyman’s picture

Issue tags: +Needs reroll

The Seven CSS files have moved. I'm happy with using the !important in this situation. jQuery UI styling makes me sad :(

Status: Needs review » Needs work

The last submitted patch, 12: 2225349-modal-style-responsive-12.patch, failed testing.

sqndr’s picture

diff --git a/core/misc/dialog.theme.css b/core/misc/dialog.theme.css
...
+@media all and (max-width: 48em) { /* 768px */
+  .ui-dialog {
+    width: 92% !important;
+  }
...
diff --git a/core/themes/seven/css/dialog.theme.css b/core/themes/seven/css/dialog.theme.css
...
+@media all and (max-width: 48em) { /* 768px */
+  .ui-dialog {
+    width: 92% !important;
+  }

Is there a reason why we are doing the same thing twice?

Update Oh, I see. The stylesheet gets overridden in Seven.

stylesheets-override:
  - css/components/vertical-tabs.css
  - css/components/jquery.ui.theme.css
  - css/components/dialog.theme.css
g.i.joe’s picture

I will look into this issue.

g.i.joe’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new930 bytes
new767 bytes

I sat next to sqndr @drupalcon Amsterdam. Where I rerolled this patch.

lauriii’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new159.67 KB
new206.89 KB
new197.41 KB

Thanks @G.I.Joe for the patch!

Seven:

Bartik:

Stark/Classy:

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
git ac https://www.drupal.org/files/issues/2225349-modal-style-responsive-18.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   930  100   930    0     0   2885      0 --:--:-- --:--:-- --:--:--  4818
error: patch failed: core/themes/seven/css/components/dialog.theme.css:10
error: core/themes/seven/css/components/dialog.theme.css: patch does not apply
lauriii’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll
StatusFileSize
new915 bytes
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5ed7af8 and pushed to 8.0.x. Thanks!

The !important makes me sad.

  • alexpott committed 5ed7af8 on 8.0.x
    Issue #2225349 by ckrina, G.I.Joe, lauriii, mErilainen: Responsive...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.