Vertical/horizontal icons missing, when toolbar has multiple items

Created on 17 January 2023, almost 2 years ago
Updated 20 March 2023, almost 2 years ago

Problem/Motivation

The horizontal/vertical icons of the toolbar are not always displayed, when the toolbar has multiple items.
This happens for example when other modules like the Workbench module are installed. The module adds the toolbar item "Workbench". I can see the icons, when I click the that "Workbench" toolbar item (see missing_icon2.png), but when I switch to "Manage" I will not see the icons anymore (see missing_icon.png).
I noticed that the buttons have the value "horizontal" or "vertical" when I am on "Workbench". Those values are completely missing when I'm on the other item and since the css uses for example [value="vertical"], it will not apply the styling (in this case the background-image) to the element.

This happens due to some changes of the toolbar's javascript (Issue #3239134):

Before the changes:

const $orientationToggle = this.$el.find('.toolbar-toggle-orientation').toggle(this.model.get('isTrayToggleVisible'));
$orientationToggle.find('button').val(antiOrientation).attr('title',this.strings[antiOrientation]).text(this.strings[antiOrientation]).removeClass(iconClass).addClass(iconAntiClass);

After the changes:

var $orientationToggleButton = $orientationToggle.find('button');
$orientationToggleButton[0].value = antiOrientation;

The [0] only applies the value to the first button, which is from the Workbench tab. That is why the icons are missing for the other tab.

Steps to reproduce

1. Install drupal/workbench module
2. Click the "Manage" tab of the toolbar
3. You should not see the vertical/horizontal Icon in the toolbar
4. Click the "Workbench" tab of the toolbar
5. You should see the vertical/horizontal Icon in the toolbar

Proposed resolution

Revert the changes in the toolbar javascript back to how it was before the change.

🐛 Bug report
Status

Needs work

Version

9.5

Component
Toolbar 

Last updated about 1 month ago

  • Maintained by
  • 🇫🇷France @nod_
Created by

🇩🇪Germany lmoeni

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024