diff --git a/components/lib/dropdown/DropdownBase.js b/components/lib/dropdown/DropdownBase.js index 3581003613..2230add1d2 100644 --- a/components/lib/dropdown/DropdownBase.js +++ b/components/lib/dropdown/DropdownBase.js @@ -20,7 +20,10 @@ const classes = { }), trigger: 'p-dropdown-trigger', emptyMessage: 'p-dropdown-empty-message', - itemGroup: 'p-dropdown-item-group', + itemGroup: ({ optionGroupLabel }) => + classNames('p-dropdown-item-group', { + 'p-dropdown-item-empty': !optionGroupLabel || optionGroupLabel.length === 0 + }), dropdownIcon: 'p-dropdown-trigger-icon p-clickable', clearIcon: 'p-dropdown-clear-icon p-clickable', filterIcon: 'p-dropdown-filter-icon', diff --git a/components/lib/dropdown/DropdownPanel.js b/components/lib/dropdown/DropdownPanel.js index 3e4a8cc34a..0009205c5f 100644 --- a/components/lib/dropdown/DropdownPanel.js +++ b/components/lib/dropdown/DropdownPanel.js @@ -98,12 +98,13 @@ export const DropdownPanel = React.memo( style = { ...style, ...option.style }; if (props.optionGroupLabel) { + const { optionGroupLabel } = props; const groupContent = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : props.getOptionGroupLabel(option); const groupChildrenContent = createGroupChildren(option, style); const key = index + '_' + props.getOptionGroupRenderKey(option); const itemGroupProps = mergeProps( { - className: cx('itemGroup'), + className: cx('itemGroup', { optionGroupLabel }), style }, getPTOptions('itemGroup')