No Code Attached Yet
avatar travisrisner
travisrisner
28 May 2025

Steps to reproduce the issue

  • Go to Users -> User Actions Log -> Options
  • Clear everything in the "Events To Log" select
  • Go back through the list and try to add them all again

Expected result

  • As one is selected it should be removed from the list to make it easier on the user to determine what is already selected

Actual result

  • Selected items remain in the list

Additional comments

Before Joomla 5.3.1, selected items in the multiselect (rendered with Choices.js) were removed from the list as they were chosen. This made the interface much more intuitive and easier to navigate.

The change appears to stem from PR #45365, which introduced the renderSelectedChoices: 'always' option. While this is beneficial in scenarios where child/parent relationships are shown (e.g., nested categories), it has unintentionally reduced usability in standard flat multiselects like this.

Is there a middle ground? The current behavior is functional, but not ideal. In the meantime, applying a small CSS tweak can improve visual clarity for selected items:

.choices__list--dropdown .choices__item--choice.is-selected::after {
  content: " ✓";
  color: green;
  margin-left: 0.5em;
  font-weight: bold;
  display: inline-block;
  opacity: 1 !important;
  visibility: visible !important;
}
avatar travisrisner travisrisner - open - 28 May 2025
avatar joomla-cms-bot joomla-cms-bot - change - 28 May 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 May 2025
avatar travisrisner
travisrisner - comment - 28 May 2025

Instead of relying solely on CSS workarounds, another option might be to make this behavior configurable via a data attribute. That would give developers more control over how selected items are displayed, depending on the use case.

avatar debdas5110
debdas5110 - comment - 29 May 2025

.choices__list--dropdown .choices__item--choice.is-selected::after { content: " ✓"; color: green; margin-left: 0.5em; font-weight: bold; display: inline-block; opacity: 1 !important; visibility: visible !important; }
This CSS targets the Choices.js dropdown list used in Joomla's multiselect field. When an item in the dropdown is selected, this style adds a green checkmark (✓) after the item's text.

avatar debdas5110
debdas5110 - comment - 29 May 2025

Am i able to resolve the problem

avatar travisrisner
travisrisner - comment - 30 May 2025

The more I think about it, the more I think this might be better served by allowing a data attribute of some sort to toggle the renderSelectedChoices option rather than just implementing a style rule. This would allow a lot more flexibility overall. I'm not sure how many fields around the core admin use the fancy-select layout, and I'm not sure which way we would prefer it to default, but I don't mind to look at tackling that.

The main annoyance I have with the way it works at the moment is if I have to scroll a long list to select an option and want to select multiples, everytime I select an option the list scrolls back to the top and I have to scroll back down to where I was.

avatar JackJoeJack
JackJoeJack - comment - 2 Jun 2025

I agree with having the option to have the "always" behaviour or the previous one.

If not, at least add some kind of visual indication and/or disallow selecting already selected options.

Also, I agree that after selecting an item, it is very annoying that the list returns to the top. But that is another issue.

avatar dawe78
dawe78 - comment - 3 Jun 2025

In addition to the css workaround I added js-code to my custom system plugin; maybe this could be an addition for next release to differentiate select fields which should keep selected items in dropdown list and such which should hide selected items. I'm using class selector "hideSelectedElements" to differentiate field "type":

jQuery(document).ready(function() {
jQuery('joomla-field-fancy-select.hideSelectedElements').each(function() {
let choicesInstance = jQuery(this)[0].choicesInstance;
if (typeof choicesInstance === 'object') {
if (choicesInstance.config.renderSelectedChoices === 'always') {
choicesInstance.config.renderSelectedChoices = 'auto';
if (choicesInstance.config.choices.length > 0) {
choicesInstance.clearStore();
choicesInstance.setChoices(choicesInstance.config.choices, 'value', 'label', true);
}
}
}
});
});

Summary:
Fields with class "hideSelectedElements":
-> selected items removed from dropdown list
"Plain" fields without "hideSelectedElements" class:
-> selected items in dropdown list: green hook will be added (css snippet above)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45536.
avatar brianteeman
brianteeman - comment - 3 Jun 2025

Using jQuery to manipulate a vanilla JS script will never be the solution. Have you looked at the scripts available Configuration options to see if what you want to do is not already an option?

The changes that were made that you do not like are inconvenient in a flat list, but without them they made a nested list unusable

avatar brianteeman
brianteeman - comment - 3 Jun 2025

Using jQuery to manipulate a vanilla JS script will never be the solution. Have you looked at the scripts available Configuration options to see if what you want to do is not already an option?

The changes that were made that you do not like are inconvenient in a flat list, but without them they made a nested list unusable

avatar dawe78
dawe78 - comment - 3 Jun 2025

@brianteeman I agree, but what I need is a configuration option to diffentiate behaviour. If I could setup field via flag in xml, eg. <field type="list" [...] hideSelectedChoices="1" /> or something like that to setup renderSelectedChoices config option in file joomla-field-fancy-select.js, everything would be fine. But there is no such config option, and that's why I had to fix it by jQuery - although its not a recommended solution. But my customers are not amused about this change, in fact; its confusing for flat lists. So - as I said before - all I need is a config option to select which behaviour is best for each field.

Would it be possible to set default value of renderSelectedChoices depending on choices array? If there are no grouped items, renderSelectedChoices should be set as auto. If array contains grouped items, set renderSelectedChoices to always by default. This could be checked and set in setChoices() method. But in the xml file should be an additional flag option to override renderSelectedChoices setting.


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

avatar richard67 richard67 - change - 3 Jun 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-06-03 14:15:30
Closed_By richard67
avatar richard67 richard67 - close - 3 Jun 2025
avatar richard67
richard67 - comment - 3 Jun 2025

Closing as having a pull request. See #45558 .

Add a Comment

Login with GitHub to post a comment