Skip to content

Conversation

@jeyip
Copy link
Contributor

@jeyip jeyip commented Oct 10, 2020

Description

When the title in the document actions area is too long, it wraps very easily. This causes visual issues and overlaps with the template part title.

How has this been tested?

  1. Enable the site editor locally
  2. Navigate to the site editor
  3. Modify the template title length in dev console to something with 15+ characters
  4. Note that when selecting a template part, the template title does not wrap
  5. Ensure that the labels don't overlap other elements when the viewport is shrunk

Screenshots

Before

Screen Shot 2020-10-07 at 8 06 06 PM

After

2020-10-09 18 21 39

Types of changes

Bug fix for #25942

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@jeyip jeyip added [Type] Bug An existing feature does not function as intended [Feature] Full Site Editing labels Oct 10, 2020
@jeyip jeyip requested a review from youknowriad as a code owner October 10, 2020 01:26
@jeyip jeyip self-assigned this Oct 10, 2020
@github-actions
Copy link

github-actions bot commented Oct 10, 2020

Size Change: +84 B (0%)

Total Size: 1.19 MB

Filename Size Change
build/edit-site/style-rtl.css 3.85 kB +44 B (1%)
build/edit-site/style.css 3.85 kB +40 B (1%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.52 kB 0 B
build/api-fetch/index.js 3.35 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 667 B 0 B
build/block-directory/index.js 8.56 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/index.js 130 kB 0 B
build/block-editor/style-rtl.css 10.9 kB 0 B
build/block-editor/style.css 10.9 kB 0 B
build/block-library/editor-rtl.css 8.65 kB 0 B
build/block-library/editor.css 8.65 kB 0 B
build/block-library/index.js 145 kB 0 B
build/block-library/style-rtl.css 7.7 kB 0 B
build/block-library/style.css 7.7 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-default-parser/index.js 1.78 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 47.6 kB 0 B
build/components/index.js 169 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 9.63 kB 0 B
build/core-data/index.js 12 kB 0 B
build/data-controls/index.js 685 B 0 B
build/data/index.js 8.63 kB 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/index.js 10.6 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.29 kB 0 B
build/edit-post/style.css 6.28 kB 0 B
build/edit-site/index.js 21.3 kB 0 B
build/edit-widgets/index.js 21.2 kB 0 B
build/edit-widgets/style-rtl.css 3.03 kB 0 B
build/edit-widgets/style.css 3.03 kB 0 B
build/editor/editor-styles-rtl.css 480 B 0 B
build/editor/editor-styles.css 482 B 0 B
build/editor/index.js 45.5 kB 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/editor/style.css 3.84 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 734 B 0 B
build/format-library/index.js 7.49 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.54 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/index.js 3.02 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.12 kB 0 B
build/notices/index.js 1.69 kB 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.44 kB 0 B
build/primitives/index.js 1.34 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 13 kB 0 B
build/server-side-render/index.js 2.6 kB 0 B
build/shortcode/index.js 1.69 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.75 kB 0 B
build/warning/index.js 1.13 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

Copy link
Member

@david-szabo97 david-szabo97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Chrome, Firefox and Safari ✅

@vindl
Copy link
Member

vindl commented Oct 12, 2020

I'm noticing the following visual issue on tablet views with long titles:

Screenshot 2020-10-12 at 18 23 58

What do you think about cutting off the text if it's too long and adding an ellipsis? Something along the lines of:

.edit-site-document-actions__title {

    /* ... */

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

position: absolute;
color: $gray-900;
font-weight: bold;
white-space: nowrap;
Copy link
Member

@vindl vindl Oct 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add this to .edit-site-document-actions__title even when secondary label is not visible and make the styling consistent with this. If we allow wrapping in that case it will wrap very long titles, and then convert it to a one line after animating, which makes the animation a bit jarring imo.

@jeyip
Copy link
Contributor Author

jeyip commented Oct 12, 2020

I'm noticing the following visual issue on tablet views with long titles:

What do you think about cutting of the text if it's too long and adding an ellipsis? Something along the lines of:

Yeah it's definitely a problem. Noah mentioned it in the issue description "The text should not wrap at all. If the text is too long, it should probably be truncated. However, in this situation, the text isn't even "too long", it just wraps very early." I also brought it up earlier here.

@vindl I was originally planning to address the just the text wrapping, and not the text overflow (overflow would potentially be a separate PR). Giving overflow more thought though, it might be simple to add some basic ellipses, so I'll experiment now and provide updates here. 👍

@noahtallen
Copy link
Member

Giving overflow more thought though, it might be simple to add some basic ellipses, so I'll experiment now and provide updates here

Nice, if it's simple enough, I'm totally fine with merging it along with this

@jeyip
Copy link
Contributor Author

jeyip commented Oct 12, 2020

Quick update:

@vindl @noahtallen Adding ellipses at an arbitrary max-width is easy enough (Marko's code works perfectly), but it looks strange when there's still a lot of white-space.

Screen Shot 2020-10-12 at 1 03 39 PM

I've been trying to allow text to truncate naturally when there is overflow (and there is no more negative space), but having everything play nicely with flexbox has been challenging. More can be read here. There are solutions proposed in the article, but apparently they don't work with flexbox items nested within other flexbox items, as is the case with our implementation.

I'm planning to explore a bit more to try and figure out a css solution, but if that doesn't work out, I think a follow-up PR might be more appropriate.

Note:
I've been avoiding javascript for now because this seems like a styling concern that's within the wheelhouse of css.

Copy link
Member

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might make things tricky, but I think the animation needs to be on the wrapper element so that it also animates the dropdown icon. Though it's not a huge issue right now, I do think it looks better to animate the dropdown, and we might end up showing the dropdown icon all the time anyways (at which point it would need to animate as well).

Other than that, the wrapping is working very well!

@jeyip
Copy link
Contributor Author

jeyip commented Oct 12, 2020

Update:

I now have text overflow being handled by CSS. The updates affected the animations a bit, so I'm in the process of fixing those as well.

It looks like the animations worked all along. The dev build process was acting wonky 🙂

Edit: I originally left the wrong animation here. The corrected one should now be shown below

2020-10-12 16 27 37

@jeyip jeyip force-pushed the fix/document-actions-title-wrapping-too-early branch from 44a3269 to e4ae3dd Compare October 12, 2020 23:37
@jeyip
Copy link
Contributor Author

jeyip commented Oct 13, 2020

This might make things tricky, but I think the animation needs to be on the wrapper element so that it also animates the dropdown icon.

The icon should now be animated 🙂

Copy link
Member

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of hardcoding the flex-basis like this, but I'm not aware of a different solution. And I trust that you spent the time to find the right one that also works :)

This works great in all my testing, so I think we can go ahead and merge it!

@jeyip jeyip force-pushed the fix/document-actions-title-wrapping-too-early branch from 0a28104 to 73ec44c Compare October 13, 2020 00:46
@jeyip jeyip merged commit 172f589 into master Oct 13, 2020
@jeyip jeyip deleted the fix/document-actions-title-wrapping-too-early branch October 13, 2020 06:26
@github-actions github-actions bot added this to the Gutenberg 9.2 milestone Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants