Problem/Motivation

Style changes for the moderation sidewbar that need to be clearly defined from the discussion in #3030786 will be done in this ticket.

Proposed resolution

  • Group the tasks and display them consistently
  • Custom log position is consistent and below the buttons
  • All links are displayed as buttons
  • Improve the color of the ghost buttons
  • Use colors for different action buttons using type_style_moderation module

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#32 3032643-ui-improvements-with-ghost-buttons-32-interdiff.txt1.05 KBsasanikolic
#32 3032643-ui-improvements-with-ghost-buttons-32.patch8.11 KBsasanikolic
#32 32-hover:focus-state.png85.99 KBsasanikolic
#32 32-normal-state.png84.55 KBsasanikolic
#27 3032643-27.patch9.53 KBkevinfunk
#27 color-update.jpg79.14 KBkevinfunk
#24 Patch 22 - custom log between.png68.69 KBsasanikolic
#24 Patch 22 - custom log below.png75.33 KBsasanikolic
#24 Patch 22.png67.52 KBsasanikolic
#24 Patch 21.png71.56 KBsasanikolic
#22 interdiff-3032643-21-22.txt2 KBsamuel.mortenson
#22 3032643-alt-22.patch7.97 KBsamuel.mortenson
#21 3032643-ui-improvements-with-ghost-buttons-21-interdiff.txt540 bytesBerdir
#21 3032643-ui-improvements-with-ghost-buttons-21.patch9.29 KBBerdir
#20 3032643-ui-improvements-with-ghost-buttons-20.patch9.29 KBsasanikolic
#19 3032643-ui-improvements-with-ghost-buttons-16-against-2988331.patch9.02 KBBerdir
#17 3032643-ui-improvements-with-ghost-buttons-16-against-8x1x.patch9.04 KBsasanikolic
#17 3032643-ui-improvements-with-ghost-buttons-16-against-8x1x-interdiff.txt536 bytessasanikolic
#14 3032643-ui-improvements-with-ghost-buttons-14-against-8x1x.patch8.83 KBsasanikolic
#14 3032643-ui-improvements-with-ghost-buttons-14-against-3032635.patch7.8 KBsasanikolic
#12 3032643-ui-improvements-with-ghost-buttons-12.patch9.08 KBsasanikolic
#10 delete-button-below-as-ghost-button.png32.07 KBsasanikolic
#10 delete-button-below-as-link.png31.3 KBsasanikolic
#10 with-patch-10.png31.94 KBsasanikolic
#10 3032643-ui-improvements-with-ghost-buttons-10.patch12.54 KBsasanikolic
#10 3032643-ui-improvements-with-ghost-buttons-10-interdiff.txt3.56 KBsasanikolic
#2 links.png31.48 KBsasanikolic
#2 ghost buttons.png31.19 KBsasanikolic
#2 3032643-ui-changes-with-links-only.patch8.8 KBsasanikolic
#2 3032643-ui-improvements-with-ghost-buttons.patch6.77 KBsasanikolic
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sasanikolic created an issue. See original summary.

sasanikolic’s picture

Here are two versions that came up to my mind after all the discussions, one with "ghost buttons" and one with links only.

Note that if we go with the links solution, I'd possibly add the ">" before the links with font awesome or material icons.

Looking forward for your feedback.

sasanikolic’s picture

Status: Active » Needs review

The last submitted patch, 2: 3032643-ui-improvements-with-ghost-buttons.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 2: 3032643-ui-changes-with-links-only.patch, failed testing. View results

sasanikolic’s picture

Patches don't apply because they're based on #3032635.

sasanikolic’s picture

Issue summary: View changes

Could we also change the font for the moderation sidebar (at least for the buttons)? It's super bulky and doesn't really fit button labels.

Berdir’s picture

Right now we have 3 different things:

* Action: Immediately publish/unpublish, discard draft: regular button
* Sidebar-Link: Translations/Revisions
* Link to a page: entity usage, confirm forms, view/edit

And we also have red to indicate destructive things (although delete is much more destructive than discard draft, but it also only goes to a confirm page). And edit is a half-action kinda and also very common, which is why our original idea was to use a ghost button for that.

Maybe delete should also be in the bottom list as a red link.

  1. +++ b/src/Controller/ModerationSidebarController.php
    @@ -282,8 +282,8 @@ class ModerationSidebarController extends ControllerBase {
     
           // Provide a list of actions representing transitions for this revision.
           if ($is_latest) {
    -        $build['actions']['quick_draft_form'] = $this->formBuilder()->getForm(QuickTransitionForm::class, $entity);
    -        $build['actions']['quick_draft_form']['#weight'] = 2;
    +        $build['actions']['primary']['quick_draft_form'] = $this->formBuilder()->getForm(QuickTransitionForm::class, $entity);
    +        $build['actions']['primary']['quick_draft_form']['#weight'] = 2;
           }
    

    maybe there should even be three sections? those on top, the quick_draft_form and those below? not sure how yet to name them yet.

  2. +++ b/templates/moderation-sidebar-container.html.twig
    @@ -14,5 +14,17 @@
    -  {{ elements.actions }}
    +  <div class="moderation-sidebar-primary-tasks">
    +    {{ elements.actions.primary|without('quick_draft_form') }}
    +
    +    <div class="moderation-sidebar-actions">
    +      {# Put the revision log above the form. #}
    +      {{ elements.actions.primary.quick_draft_form.revision_log_toggle }}
    +      {{ elements.actions.primary.quick_draft_form.revision_log }}
    +      {{ elements.actions.primary.quick_draft_form|without('revision_log_toggle', 'revision_log') }}
    +    </div>
    

    yeah, because the template currently then does exactly what I suggested above. This would then become easier if we have 3 top-level keys and if the weights in the quick actions from match the default order.

    People can then still use stuff like that if they want a different order, but we can keep the default template simpler.

Berdir’s picture

Also, I only saw specific hardcoded things in the patch I think, make sure to e.g. install entity_usage to see where that ends up now.

sasanikolic’s picture

I fixed the weights and the templates in the following patch. Local tasks as entity_usage button are placed in the secondary area now.

I also tried putting the delete button below as a ghost button and as a link, but doesn't look the right position to me.

Status: Needs review » Needs work

The last submitted patch, 10: 3032643-ui-improvements-with-ghost-buttons-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

sasanikolic’s picture

Status: Needs work » Needs review
sasanikolic’s picture

Sorry for the spam, posting the patches against 8.x-1.x and template changes in issue #3032635 here.

johnchque’s picture

Status: Needs review » Needs work
+++ b/src/Controller/ModerationSidebarController.php
@@ -282,13 +282,12 @@ class ModerationSidebarController extends ControllerBase {
+    $build['actions']['secondary'] += $this->getLocalTasks($entity);

This will create problems as 'secondary' can be null. I think we should initialize it as [];

sasanikolic’s picture

sasanikolic’s picture

Status: Needs work » Needs review
Berdir’s picture

This is a patch against #2988331: Content translation moderation because it conflicts with that in a few cases. We definitely want to get that in first, as that fixes a lot of bugs while I'm sure this will need some more discussion.

It will obviously not apply on d.o, but I would suggest that if you make further changes here, you always work against the latest patch in the other issue.

sasanikolic’s picture

Here is a rebased patch for 8.x. branch.

Berdir’s picture

samuel.mortenson’s picture

This is close, but there were three things I wanted to change:

1. Ghost buttons normally invert color/background on hover, so I added that.
2. The "danger" links should look like action buttons - I know there's a confirmation for deleting the node but discarding the draft has no confirmation so it should feel dangerous.
3. I didn't like the new placement of the revision log field - I get how this is probably nice for people that fill it out, because you want to fill it out before making the action, but not all users fill this out every time and it broke up the actions in a way that I thought didn't look nice. This is totally my opinion so I'm happy to chat about this more if you'd like.

If you're OK with the changes above, you can mark the issue as RTBC and I'll commit. Otherwise we can iterate on the design more.

Berdir’s picture

Thanks for the feedback! I'll check this internally, there's also always the option to override something if we can't agree, that's fine. Will think about the position, it kind of made sense to me because even if you don't fill it out, you need to be aware of doing so before you press that button. But we'll try it out.

sasanikolic’s picture

Status: Needs review » Needs work
FileSize
71.56 KB
67.52 KB
75.33 KB
68.69 KB

The button changes from @samuel.mortenson make sense to me. Looks much better imho and hover should behave as a button, not as a fake link inside a button.

A few remarks though:
- The weight is not consistent, in the published state the custom log message is above the delete content, in the draft state it's below.
- Let's fix the alignment of the check icon and text position, as they are currently way off. Let's left and bottom align it - or does that happen because of our global form styles? Could you post how does that look on a clean environment?

Attaching our screenshots for comparison.

miro_dietiker’s picture

> 1. Ghost buttons normally invert color/background on hover, so I added that.

Can you point me to some real Drupal styleguide that defines this?
We found such definitions in many other styleguides and adopted it in a first iteration. Furtheriterations with UX research showed that inversion on hover creates visual irritation and we try to never do this and instead apply a 20% change on BG / FR color. This, by trying to shift it into the direction of higher contrast on hover, not less.

As a comparision, material.io only applies a slight effect, typically adding BG. They however reduce text readability with their hover in most cases, but only slightly - so it doesn't hurt that much:
https://material.io/design/interaction/states.html#hover

samuel.mortenson’s picture

@miro_dietiker I don't think there's a Drupal styleguide for this, I think it's just common for ghost buttons to behave this way. I would rather go back to the old button styling (or something similar, they should look like buttons) than just underline the text inside the button, which was the styling in #21.

kevinfunk’s picture

FileSize
79.14 KB
9.53 KB

Love the new look! What everyone's thoughts on updating the colors so we don't have two blue buttons?
Colors

samuel.mortenson’s picture

@kevinfunk https://www.drupal.org/project/type_style has a sub-module, type_style_moderation, that allows you to set colors for Workflow transitions. That's how I'd recommend setting colors, because otherwise we would have to hard-code color mappings for transition IDs, which may differ across sites.

An integration for Moderation Sidebar used to live in DF: https://github.com/acquia/df/commit/fc688c8c30c395fffa9eff67d4a5d65588a2...

kevinfunk’s picture

That's understandable. Thanks @samuel.mortenson.

miro_dietiker’s picture

sasanikolic’s picture

Issue summary: View changes
sasanikolic’s picture

Hi @samuel.mortenson, I took a look at this issue again as we'd like to move forward.

I noticed that the focus effect was missing for the sidebar link and added that. Also changed the hover color from white to a slight greyish like we use for the text above, as I feel that is a bit too much contrast for a ghost button. What do you think?

We are also missing the active state for the links, might be a good addition for accessibility?

  • sasanikolic authored f129f9e on 8.x-1.x
    Issue #3032643 by sasanikolic, Berdir, samuel.mortenson, kevinfunk,...
samuel.mortenson’s picture

Status: Needs review » Fixed

I'm doing a release today and wanted to get this in after tagging. I reviewed #32 and think it's good enough to move forward with. For active state on links - please file a new issue is this is needed, I'm not an expert on that but it seems like a good addition. Thanks for being patient everyone!

I'm going to ask people using the new release to review the UI changes so that the next release (8.x-1.4) isn't too surprising for everyone.

Status: Fixed » Closed (fixed)

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

acbramley’s picture

Just a note that this causes breaking changes for alter hooks and template overrides, see #3137427: Document render/TWIG changes introduced by 1.4 these need to be documented in the release notes at the very least.