Problem/Motivation

Background

It is currently possible that a toolbar is empty, i.e. that there is a link in the toolbar but no actual toolbar menu items are revealed when clicking on that link. This happens most prominently when granting users the access toolbar permission, but no access to any administrative pages. Then the "Manage" toolbar item will appear, but without any actual links.

The fact that this is currently the case is being discussed - and potentially fixed - over in #2135445: Toolbar displays Manage tab even if the user is not permitted to see it, but until that is resolved this constitutes a separate bug.

Problem description

When there is an empty toolbar tray, the orientation toggle is still displayed. It does in fact allow switching the orientation, but this is pointless as there are no menu items. Moreover, in (the default) horizontal orientation the toggle "floats" beneath the toolbar where the tray would usually be displayed - except that there is no tray, only the toggle.

Screenshot of the bug with the orientation toggle floating beneath the toolbar

Steps to reproduce

Grant a user only access to access the toolbar, nothing more.

Proposed resolution

Don't add the orientation toggle if there is no tray.

Remaining tasks

User interface changes

The toolbar toggle is no longer erroneously displayed for empty trays.

API changes

-

Data model changes

-

Release notes snippet

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Status: Active » Needs review
StatusFileSize
new1.98 KB
new3.56 KB

Here we go. We manually append the orientation toggle, so simply appending it to the tray menu fixes this bug, as that will not happen if there is no menu. Added a little test as well and attaching a tests-only patch to prove the test's validity.

The last submitted patch, 2: 3257504-2-tests-only.patch, failed testing. View results

nod_’s picture

Issue summary: View changes
nod_’s picture

Version: 9.2.x-dev » 9.4.x-dev

Fix is reasonable, it's mostly on trays with menus that happens so it works to check for the menu class.

It does change the source order a little (in the case of the shortcut tray) would be best to make sure we get the same source before/after the patch.

tstoeckler’s picture

StatusFileSize
new1.76 KB
new3.56 KB

Good catch! I had totally missed that and you're absolutely right that we should not be changing the markup here. This one should be better.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, does not change the selected element now. Good find!

  • lauriii committed 6b8783b on 10.0.x
    Issue #3257504 by tstoeckler, nod_, Gábor Hojtsy: Empty toolbar tray...

  • lauriii committed 1c4c128 on 9.4.x
    Issue #3257504 by tstoeckler, nod_, Gábor Hojtsy: Empty toolbar tray...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0c2677b and pushed to 10.0.x by locally re-compiling the JavaScript. Committed the patch to 9.4.x. Thanks!

Status: Fixed » Closed (fixed)

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