Long words overflow out of modals

Created on 8 November 2023, 8 months ago
Updated 16 January 2024, 5 months ago

Problem/Motivation

While performing any delete operation that open up in a modal if you have a very long label associated with it then the long label overflows from the modal as attached in the screenshot.

Steps to reproduce

Add a view mode with a very long string
Delete that view mode
See text goes out of modal (see before screenshot)

Proposed resolution

Add ellipsis to dialog css

Remaining tasks

Commit

User interface changes

Before

After

API changes

NA

Data model changes

NA

Release notes snippet

NA

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
CSSย  โ†’

Last updated 5 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs frontend framework manager review

    Used to alert the fron-tend framework manager core committer(s) that a front-end focused issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Utkarsh_33
  • Merge request !5290Added word-wrap property โ†’ (Open) created by Utkarsh_33
  • Status changed to Needs review 8 months ago
  • Hi @Utkarsh_33,
    I tested your #3 MR and it is working fine. The dialog title overflow issue is fixed now. But I can see this issue in other elements too, so according to me it should fixed globally like:

    body {
    word-break
    }
  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Cleaned up the issue summary some and attached an after screenshot of the issue being fixed.

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Interesting.

    1. My first thought upon reading the issue title was "Wouldn't this apply to all modals?" Fortunately, the changes are being added to core/themes/claro/css/components/dialog.pcss.css, so the fix also applies to all modals.
    2. My second thought was "Wouldn't this apply to all content, not just labels? The classes being updated are .ui-dialog .ui-dialog-titlebar, so the change here is only affecting the title, not the modal content.
    3. My third thought was "Is this limited only to Claro?" In general, if one theme has a bug, we should check the other themes for the same bug.
    4. Finally, I'd forgotten the exact details of how the word break property behaves. I was unsure if this would break only long words, or all words for wrapping. Fortunately https://developer.mozilla.org/en-US/docs/Web/CSS/word-break has a handy interactive tool. The value of this property I was worried about is word-break: break-all;. break-word is correct and so that's fine.
    5. Points 1 and 4 above are fine. However, I think we need additional testing for points 2 and 3. Try putting a long word in the dialog content area and see what happens. And see if other core themes have the same issue.

      Thanks!

  • I tested the above 2 mentioned points in #6 ๐Ÿ› Long words overflow out of modals Needs work manually and everything is working as expected for all the 3 themes that i tested. Attaching the screen recording and screen shots for the same.

  • Status changed to Needs review 7 months ago
  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shyam_Bhatt Gujarat

    @Utkarsh_33 @xjm I have checked the "MR !5290" and patch #6 ๐Ÿ› Long words overflow out of modals Needs work both are working fine.

    Please check the below images. The above change is working fine in every device layout.

    Before:

    After:

    + Moving to RTBC

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    Thanks @Utkarsh_33 for testing those scenarios. Adding credit.

    @Shyam_Bhatt The issue was already manually tested, so we do not need additional screenshots after that. (So, I have not granted credit for it.)

    Based on @Utkarsh_33's testing, it looks like Olivero and Stark instead truncate the word with an ellipsis, rather than wrapping it (probably text-overflow: ellipsis;?). We should do the same here.

    Thanks everyone!

  • Status changed to Needs review 7 months ago
  • Updated the changes as per #11.
    Thanks

  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Confirmed the latest changes now use ellipsis vs wordbreak.

    I've updated the issue summary with the new proposed solution and a new after screenshot since the old one was the word-break

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm

    I tried to figure out where the CSS for the ellpsis in Stark was coming from in order to compare the other style changes, and now I'm confused:

    [ayrton:drupal | Sat 10:20:38] $ grep -r "ellipsis" * | grep "css" | grep -v "vendor" | grep -v "node_modules"
    core/modules/locale/css/locale.admin.css:  text-overflow: ellipsis;
    core/modules/workspaces/css/workspaces.toolbar.pcss.css:    text-overflow: ellipsis;
    core/modules/workspaces/css/workspaces.toolbar.css:    text-overflow: ellipsis;
    core/modules/system/tests/src/Functional/Pager/PagerTest.php:    $elements = $this->cssSelect(".pager__item--ellipsis:contains('โ€ฆ')");
    core/modules/system/tests/src/Functional/Pager/PagerTest.php:    $elements = $this->cssSelect(".pager__item--ellipsis:contains('โ€ฆ')");
    core/themes/stable9/css/locale/locale.admin.css:  text-overflow: ellipsis;
    core/themes/stable9/css/system/system.admin.css:  text-overflow: ellipsis;
    core/themes/claro/css/theme/media-library.pcss.css:  text-overflow: ellipsis;
    core/themes/claro/css/theme/media-library.css:  text-overflow: ellipsis;
    

    Olivero does not extend Stable 9, so where is the ellipsis there coming from? Additionally, the CSS in system.admin.css is not targeted to dialogs:

    .system-modules details {
      overflow: hidden; /* truncates descriptions if too long */
      white-space: nowrap;
      text-overflow: ellipsis;
      color: #5c5c5b;
      line-height: 20px;
    

    ๐Ÿค”

    Maybe someone could drill down inspecting the Stark and Olivero CSS in browser developer tools to document the comparable CSS there? Failing that, maybe a frontend framework manager can give us some direction.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States xjm
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gauravvv Delhi, India

    I have checked in Claro theme and we are using word-wrap: break-word; hyphens: auto; at most of places.

    1. Media library: https://git.drupalcode.org/issue/drupal-3400027/-/blob/3400027-the-label-overflows/core/themes/claro/css/theme/media-library.pcss.css
    2. Vertical Tabs: https://git.drupalcode.org/issue/drupal-3400027/-/blob/3400027-the-label-overflows/core/themes/claro/css/components/vertical-tabs.pcss.css
    3. Form--managed-file.css
    4. details.css

    and in details.css file of Olivero theme as well.

    We're not using ellipsis inside Olivero theme. We should use word-wrap: break-word; hyphens: auto; here as well.

  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI

    #14

    I tried to figure out where the CSS for the ellpsis in Stark was coming from in order to compare the style changes, and now I'm confused:

    jQuery UI's CSS in the vendor dir (๐Ÿ‘ on including your grep!)

    #11

    Based on @Utkarsh_33's testing, it looks like Olivero and Stark instead truncate the word with an ellipsis, rather than wrapping it (probably text-overflow: ellipsis;?). We should do the same here.

    I probably agree with this, but since Claro uses larger fonts I think it's worth checking some common modals at narrow-but-common widths. Fewer characters can fit in that titlebar with Claro, so I'd like to rule out the truncation making it unusable. For example, things like deleting content via admin/content are done via Modal and those could get long. It's also possible that some translations result in significantly more characters. This may have been the reason Claro opted to override Jquery's default dialog styling and allow multple lines.

    If the conclusion is to match the other themes, then the feedback in the MR I left should be addressed.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia deepanshu.varshney

    deepanshu.varshney โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia deepanshu.varshney

    I have made the changes as per the comment #17

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Nitin shrivastava

    @deepanshu.varshney
    MR#18 is working fine, after applying the patch the overflow issue is resolved.

    Before :

    After :

    Thanks!

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI

    Re my comment in #17 - there needs to be an assessment of common modals used in Claro and determine if the current solution provides adequate space for the modal title to be understandable/useful.

Production build 0.69.0 2024