Problem/Motivation

For example, there are several instances in core where 700px is hard coded for the width of dialogs.

'data-dialog-options' => Json::encode([
                  'width' => 700,
                ]),

"Setting a fixed 700 pixel width means this could appear unnecessarily narrow on larger screens. Although many of the form elements seem to look just the same, it scrunches up textareas and WYSIWYG fields a little awkwardly. A percentage would be better but it doesn't look like we could pass a non-px value to the jQuery settings: https://api.jqueryui.com/dialog/#option-width"

These may have been sufficient for smaller displays and the now-removed Seven theme which had smaller form elements. Uses should be evaluated with the awareness wider displays are more commonly used, and that Claro is chunkier.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3342816

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hooroomoo created an issue. See original summary.

hooroomoo’s picture

bnjmnm’s picture

Issue tags: +Field UX
bnjmnm’s picture

It looks like jQuery UI dialog can handle % or vw widths?
for example these will both work:

jQuery('h1').dialog({width: '60%'})
jQuery('h1').dialog({width: '30vw'})

This means we don't need to do anything wild in Drupal to allow this, but we ought to provide a PR to https://github.com/jquery/api.jquery.com to get their docs current as they currently say it only accepts a pixel value for width:

lauriii’s picture

How the width work acts is essentially as a max-width for the dialog. Usually the max-width is set as a static value instead of a dynamic value to ensure that text remains legible on large screens. On pages like content edit forms where Claro restricts width, the max-width is 880px which includes 3rem of padding. Therefore, I think we should just update these values to 880px to slightly increase the available space when that's allowed.

Note that we were using vw values for modal widths as part of a prototype we tested with users. Some users using a large screen were confused about the amount of information displayed on page. One of the users resized the browser window to limit the modal width and commented that it looks less confusing after resizing the screen.

ckrina’s picture

I agree with @lauriii about the need to limit the with on bigger screens to prevent readability issues. In an ideal world, @bnjmnm 's suggestion to use vw to define the width would be ideal, and then limit it to a max-width that keeps the maximum 60-80 characters per line on place. But since the only option is to define some sort of max-width, I'd prioritize readability. And 880px seems right to me.

Utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

Status: Active » Needs review
lauriii’s picture

Issue tags: +Needs manual testing

We need to manually confirm that the new width looks good on all of the instances that are being changed.

utkarsh_33’s picture

StatusFileSize
new518.69 KB
new235.16 KB
new375.47 KB
new354.59 KB

I have tested all the modals manually.Attaching the screen shots for all the cases.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing +Needs Review Queue Initiative

Seems the manual testing was done in #11. Not going to reupload additional screenshots. The ones attached look like nothing broke.

bnjmnm’s picture

Title: Replace hardcoded 700px width in dialog modals » Adjust hardcoded widths in dialog modals
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
bnjmnm’s picture

StatusFileSize
new59.66 KB

Unless it blocks the issue overall, it could be worth including the leave preview dialog. That one is a little different as the width is calculated automatically, but that width is calculated before the buttons are moved to the lower pane. It would look a little more self assured with the buttons next to one another.

utkarsh_33’s picture

Status: Needs work » Needs review

I have created a follow-up issue for #14 which can be found here.Rest all the other feedbacks are addressed so moving it to NR.

lauriii’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Related issues: +#3359012: Claro: Modal dialog buttons not aligned in the "Leave preview" dialog.
StatusFileSize
new91.82 KB

I agree that the block form could use some additional space due to the vertical tabs. IMO the value @Utkarsh_33 picked looks good.

  • ckrina committed a7a40c9e on 10.1.x
    Issue #3342816 by Utkarsh_33, bnjmnm, lauriii: Adjust hardcoded widths...
ckrina’s picture

Status: Reviewed & tested by the community » Fixed

Committed a7a40c9 and pushed to 10.1.x. Thanks!

  • ckrina committed 55639a0f on 11.x
    Issue #3342816 by Utkarsh_33, bnjmnm, lauriii: Adjust hardcoded widths...

Status: Fixed » Closed (fixed)

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