Skip to content

[6.1] Support class and additional attribute for optgroup#46739

Merged
bembelimen merged 3 commits intojoomla:6.1-devfrom
HLeithner:6.1/feature/select-grouped-attributes
Feb 10, 2026
Merged

[6.1] Support class and additional attribute for optgroup#46739
bembelimen merged 3 commits intojoomla:6.1-devfrom
HLeithner:6.1/feature/select-grouped-attributes

Conversation

@HLeithner
Copy link
Member

@HLeithner HLeithner commented Jan 21, 2026

Summary of Changes

Allow to add class attribute and additional attributes to select.groupedlist htmlhelper.
This allows the optgroup the same attributes like select.options

Testing Instructions

create a HTMLHelper::_('select.groupedlist'); which includes group.class and group.attr entries.

Example:

$data = [];
$data[0]['items'][''] = Text::_('JSELECT');
$data['group1'] = [
  'label' => 'I'm group 1',
  'items' => [
    'value1' => 'text1',
    'value2' => 'text2',
  ]
  'class' => 'niceclass',
  'attr' => 'data-additional="information"'
];

echo \Joomla\CMS\HTML\HTMLHelper::_('select.groupedlist', $data, 'testname' , [
  'group.items' => 'items',
  'group.label' => 'label',
  'group.class' => 'class',
]);

Actual result BEFORE applying this Pull Request

<select name="testname">
  <option value="" selected="selected">Auswählen</option>
  <optgroup label="I am group 1">
    <option value="value1">text1</option>
    <option value="value2">text2</option>
  </optgroup>
</select>

Expected result AFTER applying this Pull Request

<select name="testname">
  <option value="" selected="selected">Auswählen</option>
  <optgroup label="I am group 1" class="niceclass" data-additional="information">
    <option value="value1">text1</option>
    <option value="value2">text2</option>
  </optgroup>
</select>

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@Fedik Fedik added the Feature label Jan 21, 2026
@tecpromotion tecpromotion added the PBF Pizza, Bugs and Fun label Jan 23, 2026
@dgrammatiko
Copy link
Contributor

@HLeithner although this is nice enhancement it falls quite sort for the upcoming (already available in the chromium supported browsers) <select> changes:
Docs: whatwg/html#10548

Video: https://www.youtube.com/shorts/6yFm0BLI2hk

@HLeithner
Copy link
Member Author

I like it @dgrammatiko but I think we are not there yet https://caniuse.com/selectlist (all read and behind feature flag) since 2022.

Anyway we would need another approach for this kind of customization, maybe finally a layout for the htmlhelper.select.xxx but I think we will not be the first supporting this ;-)

@VaishnaviSidral
Copy link

I have tested this item ✅ successfully on 5dd1b89

I tested this issue, and it was tested successfully.


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

@nadjak77
Copy link
Contributor

I have tested this item ✅ successfully on 5dd1b89

There are two faults in the example data:

@hamby
Copy link

hamby commented Jan 31, 2026

I have tested this item ✅ successfully on 5dd1b89


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

@tecpromotion tecpromotion removed PBF Pizza, Bugs and Fun Feature labels Feb 10, 2026
@tecpromotion
Copy link
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 10, 2026
@bembelimen bembelimen merged commit 18b1745 into joomla:6.1-dev Feb 10, 2026
2 of 3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 10, 2026
@bembelimen
Copy link
Contributor

Thanks

@bembelimen bembelimen added this to the Joomla! 6.1.0 milestone Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants