? Pending

User tests: Successful: Unsuccessful:

avatar SharkyKZ
SharkyKZ
15 Sep 2018

Pull Request for Issue #22182 .

Summary of Changes

This fixes menu item type ordering for items starting with lowercase.

Testing Instructions

Create administrator language override for component name. Change it to start with lowercase, e.g. COM_CONTACTS="contact".
Create a menu item and choose a menu item type. See ordering of menu item types.

Expected result

Items sorted alphabetically.

Actual result

contact sorted at the bottom.

Documentation Changes Required

No.

avatar SharkyKZ SharkyKZ - open - 15 Sep 2018
avatar SharkyKZ SharkyKZ - change - 15 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Sep 2018
Category Administration com_menus
avatar infograf768
infograf768 - comment - 15 Sep 2018

I have tested this item successfully on 2a2a55e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22189.

avatar infograf768 infograf768 - test_item - 15 Sep 2018 - Tested successfully
avatar alikon
alikon - comment - 15 Sep 2018

I have tested this item successfully on 2a2a55e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22189.

avatar alikon alikon - test_item - 15 Sep 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Sep 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Sep 2018

Ready to Commit after two successful tests.

avatar ColinM2
ColinM2 - comment - 15 Sep 2018

Hi
I have also noticed that if one includes an Image/icon with the name then those items are not includes alphabetically but they appear out of sequence.
See pics attached for components list and menu type list
components list
menu item types list

avatar mbabker
mbabker - comment - 15 Sep 2018

The icon issue is probably not one that can be fixed because the icons are being included into the label; we can't try to extract those and sort on the remaining text.

avatar mbabker mbabker - change - 15 Sep 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-09-15 16:28:29
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 15 Sep 2018
avatar mbabker mbabker - merge - 15 Sep 2018
avatar ColinM2
ColinM2 - comment - 16 Sep 2018

Thanks for looking. Maybe it is possible to filter the label text to exclude html?
Seems to me some extension developers are trying to get their 'extension' at the top of the list! Suppose in fullness of time that there could be a specific icon field so that the icon is used in the visible but the sort is done on the filtered title. In either scene html filtering would provide a level playing field.

avatar helpwise
helpwise - comment - 5 Oct 2018

Why not give them all an icon (use a default if not set) ;)

avatar ColinM2
ColinM2 - comment - 8 Oct 2018

Good idea to have an Icon anyway. Think the Developer just needs to add it into the component title.
But the HTML would still need to be excluded in the search to arrange into proper non case sensitive alpha order. About 9 years ago mariusz.tarnaski at wp dot pl provided a routine in the notes to the php function strip_tags called strip_tags_content that removes the HTML and PHP tags and their content.
See the first contributed note in http://php.net/manual/en/function.strip-tags.php

avatar helpwise
helpwise - comment - 9 Oct 2018

On second thoughts having generic icons will not help much in sorting by text 'with' icon html text. The icon names will then be used to sort.

The icon should be in its own table column, not in the menu text string. Another Joomla quick fix that became a standard :(

The simplest backward compatible fix is to add an 'order' column to all admin menu items, and then use ORDER BY 'ordering' and then 'title'.

avatar brianteeman
brianteeman - comment - 9 Oct 2018

That is already possible if you create custom admin menus

avatar ColinM2
ColinM2 - comment - 11 Oct 2018

Good idea for some but with the jDownloads component we prefer to keep with 'standard' Joomla! as far as possible.

avatar mbabker
mbabker - comment - 11 Oct 2018

I'm only going to speak for myself here but I personally don't think we need to be post-processing this text to remove icons. If someone wants to (re-)implement a feature to have this menu support icons with a proper API, by all means go for it, but there is nothing to be gained by stripping HTML from these labels (and no, the inclusion of an icon in the text does not prevent a "level playing field", this isn't the JED where someone tries to "game the system", if anything I would say it's those extension developers introducing UX confusion by adding non-standard output and breaking the alphabetical sorting of the menu and it's not Joomla's responsibility to police it up).

avatar ColinM2
ColinM2 - comment - 12 Oct 2018

@mbabker Was intrigued when you said "nothing to be gained by stripping HTML from these labels".
So I looked at what was generated and, as I now expected, you were right. So I analysed further.
Basically those with an image have included a space character in the title to separate from the image.

So if a trim() or at least an ltrim() were included in the sort then it would level the playground. The list would then sort and the icon would be irelevant.

See notes in pic below

aaa-2018-10-12_171017

avatar mbabker
mbabker - comment - 12 Oct 2018

To do what you want us to do would mean arbitrarily stripping HTML from the titles. Even if the icon is only ignored as it relates to sorting, the string would still have to have the HTML stripped before it could be put into a sort algorithm otherwise you're sorting on something where the first character is < compared to another something where the first character is a "normal" alphabetic character.

Either we put (back in) support for defining an icon with a proper API or we do nothing. I don't think we need to be doing any kind of extra processing, especially to "level the playing field" because what playing field is there to be leveled in your site's backend? Is it really that big of a competitive advantage that an extension you've already installed (and potentially paid for) might be sorted awkwardly? I said before I would moreso argue is a UX bug with those extensions trying to include the icon than a core bug we need to invest resources into addressing (because those extensions are breaking the expected default alphabetic sorting mechanism by including <img> tags in their titles).

avatar ColinM2
ColinM2 - comment - 13 Oct 2018

You misunderstand me! No API is needed, the only change would be to add a trim() in the sort code sequence. Those extensions that are including an icon have a space as the leading character of the text. This space causes the sort to put them in the wrong position. Adding a trim() fuction will just finish the job and it will then not matter if there is or is not an icon.
So I fully agree with your thoughts and observations. There is no need for an API or something so extensive, just a trim() or an ltrim() inclusion in the code, please!
From analysing the results it is now clear that the existing code is fully managing to successfully avoid the html bits and is getting the correct text string for the sort. However the space char has a lower ASCII value than any digit or alpha character so that is the reason for the present sequence.

As you say this is not 'an end of world' issue just a tidy up in search of a tiny improvement to Joomla! which I have been using since version 1.

avatar brianteeman
brianteeman - comment - 13 Oct 2018

They do not have to have a space. If the developer is doing this to make their extension appear at the top of the list on purpose then they will always find a way to achieve it. If you really want to ensure its in a different place then you should create your admin menus.

avatar ColinM2
ColinM2 - comment - 14 Oct 2018

But if they do have a space then it will not sort as intended. There is no presumption that some developers are 'cheating'. Surely just asking for the inclusion of a trim() function in the sort is not a big deal. With that then any extension that 'defeats' the sort is probably doing it deliberately.

avatar mbabker
mbabker - comment - 14 Oct 2018

We are not post-processing the translation labels. Period.

avatar helpwise
helpwise - comment - 15 Oct 2018

The component menu list UX is designed to be alphabetical. Trimming it will normalise the results.

And its possible that Joomla, (not the developer) is adding the space (only where there is an icon) in the first place... I'll check..

avatar infograf768
infograf768 - comment - 15 Oct 2018

The ini string for Breezing form is clearly adding the space, not Joomla.

COM_BREEZINGFORMS="<img src="../administrator/components/com_breezingforms/images/icons/component-menu-icons/bf_icon.png" width="23"; /> BreezingForms Free"

As far as I tested, in any case, trimming that space does NOT alpha order the menu.

screen shot 2018-10-15 at 07 37 05

The reason is very simple: the < character &#60; used for the <img src has a lower value than any letter in the ascii table.
The B for BreezingForm is &#66;
http://www.asciitable.com/

IF the string was presented this way (Icon after the title, with a space at the beginning), then trimming would make sense.
COM_BREEZINGFORMS=" BreezingForms Free <img src="../administrator/components/com_breezingforms/images/icons/component-menu-icons/bf_icon.png" width="23"; />"

Let's finish please with this discussion that goes nowhere....

avatar SharkyKZ
SharkyKZ - comment - 15 Oct 2018

Extension names shouldn't have any HTML. They're meant to be reusable in many different contexts. See their wide use in com_actionlogs for example.

avatar helpwise
helpwise - comment - 15 Oct 2018

As noted earlier by infograf768, I can confirm that Developers DO include the spaces themselves, and that removing the icon via an admin language override fixes the issue.

avatar brianteeman
brianteeman - comment - 15 Oct 2018

@mbabker has already stated that we will not do any post processing on the menu item name. You have already identified a solution (language override).

This is now locked

Add a Comment

Login with GitHub to post a comment