Bug Description
The ui5-toolbar-select component provides no reliable, documented way to identify which option was selected in the change event. The change event provides e.detail.selectedOption, but this is an internal ui5-option element created by the component, not the original ui5-toolbar-select-option.
Key issues:
ui5-toolbar-select-option has no value property (unlike ui5-option)
- Custom
data-* attributes on ui5-toolbar-select-option are not accessible from e.detail.selectedOption
- Using
textContent matching fails when multiple options have the same text
- The only working approach relies on
data-ui5-external-action-item-index, an internal implementation detail
This makes it impossible to associate metadata with options in a reliable way.
Affected Component
ui5-toolbar-select, ui5-toolbar-select-option
Expected Behaviour
Developers should be able to reliably identify which option was selected and access associated metadata. Similar to how ui5-select works with ui5-option which has a value property, ui5-toolbar-select-option should provide a way to identify options beyond their text content.
Proposed solutions (not mutually exclusive):
- Pass through
data-* attributes - Ensure all data-* attributes on ui5-toolbar-select-option are copied to the internal ui5-option element, making them accessible via e.detail.selectedOption.dataset
- Add
value property - Add a value property to ui5-toolbar-select-option (like ui5-option has) and pass it through to the internal option
- Return original element - Change
e.detail.selectedOption to return the ui5-toolbar-select-option element instead of the internal ui5-option
- Add new event detail field - Keep
e.detail.selectedOption as is, but add e.detail.selectedToolbarOption that references the original ui5-toolbar-select-option
Isolated Example
https://stackblitz.com/edit/js-xllyvuxz?file=index.js
Steps to Reproduce
- Open https://stackblitz.com/edit/js-xllyvuxz?file=index.js
- Look at the first ToolbarSelect - it has options with
data-filter-id attributes
- Click on the first ToolbarSelect and select a different option (e.g., "Inactive Items")
- Observe the output box below showing:
dataset: {} is empty - the data-filter-id attribute is not accessible
value: undefined - no value property exists
- Only
textContent is available, which is unreliable
- Scroll down to the second ToolbarSelect with duplicate "Pending" options
- Select the second "Pending" option (the one for urgent pending items)
- Observe the output showing text matching incorrectly identifies it as the first "Pending"
- The only working approach uses
data-ui5-external-action-item-index, an undocumented internal attribute
Log Output, Stack Trace or Screenshots
See the StackBlitz console output which shows:
// e.detail.selectedOption properties:
{
textContent: "Active Items",
value: undefined,
dataset: {} // Empty! Cannot access data-filter-id
}
Priority
High
UI5 Web Components Version
2.21.0
Browser
Chrome
Operating System
All
Additional Context
Business Impact:
This issue affects any application using ui5-toolbar-select for filtering or navigation where options need to carry metadata beyond their display text. Common use cases:
- Table filters with query parameters
- Navigation menus with route objects
- Action toolbars where options trigger different operations
Current Workaround:
We're forced to use text matching (e.detail.selectedOption.textContent), which:
- Breaks with duplicate option text
- Is fragile (whitespace, localization changes break it)
- Cannot handle non-unique display names
Real-world scenario from SAP SuccessFactors:
We have table filters where "Pending" appears twice with different parameters:
- "Pending" →
{status: "pending"}
- "Pending" (urgent) →
{status: "pending", urgent: true}
Text matching always selects the first "Pending", making the second option unusable.
Related Code:
ToolbarSelect.ts line 204-209: Uses data-ui5-external-action-item-index internally but this isn't public API
ToolbarSelectOption.ts: Has no value property, only selected and text
Select.ts: The underlying ui5-select works correctly because ui5-option has a value property
Comparison with similar components:
ui5-select + ui5-option: Works correctly, ui5-option has value property
ui5-toolbar-select + ui5-toolbar-select-option: Broken, no value property
Organization
SuccessFactors
Declaration
Bug Description
The
ui5-toolbar-selectcomponent provides no reliable, documented way to identify which option was selected in thechangeevent. The change event providese.detail.selectedOption, but this is an internalui5-optionelement created by the component, not the originalui5-toolbar-select-option.Key issues:
ui5-toolbar-select-optionhas novalueproperty (unlikeui5-option)data-*attributes onui5-toolbar-select-optionare not accessible frome.detail.selectedOptiontextContentmatching fails when multiple options have the same textdata-ui5-external-action-item-index, an internal implementation detailThis makes it impossible to associate metadata with options in a reliable way.
Affected Component
ui5-toolbar-select, ui5-toolbar-select-option
Expected Behaviour
Developers should be able to reliably identify which option was selected and access associated metadata. Similar to how
ui5-selectworks withui5-optionwhich has avalueproperty,ui5-toolbar-select-optionshould provide a way to identify options beyond their text content.Proposed solutions (not mutually exclusive):
data-*attributes - Ensure alldata-*attributes onui5-toolbar-select-optionare copied to the internalui5-optionelement, making them accessible viae.detail.selectedOption.datasetvalueproperty - Add avalueproperty toui5-toolbar-select-option(likeui5-optionhas) and pass it through to the internal optione.detail.selectedOptionto return theui5-toolbar-select-optionelement instead of the internalui5-optione.detail.selectedOptionas is, but adde.detail.selectedToolbarOptionthat references the originalui5-toolbar-select-optionIsolated Example
https://stackblitz.com/edit/js-xllyvuxz?file=index.js
Steps to Reproduce
data-filter-idattributesdataset: {}is empty - thedata-filter-idattribute is not accessiblevalue: undefined- no value property existstextContentis available, which is unreliabledata-ui5-external-action-item-index, an undocumented internal attributeLog Output, Stack Trace or Screenshots
See the StackBlitz console output which shows:
Priority
High
UI5 Web Components Version
2.21.0
Browser
Chrome
Operating System
All
Additional Context
Business Impact:
This issue affects any application using
ui5-toolbar-selectfor filtering or navigation where options need to carry metadata beyond their display text. Common use cases:Current Workaround:
We're forced to use text matching (
e.detail.selectedOption.textContent), which:Real-world scenario from SAP SuccessFactors:
We have table filters where "Pending" appears twice with different parameters:
{status: "pending"}{status: "pending", urgent: true}Text matching always selects the first "Pending", making the second option unusable.
Related Code:
ToolbarSelect.tsline 204-209: Usesdata-ui5-external-action-item-indexinternally but this isn't public APIToolbarSelectOption.ts: Has novalueproperty, onlyselectedandtextSelect.ts: The underlyingui5-selectworks correctly becauseui5-optionhas avaluepropertyComparison with similar components:
ui5-select+ui5-option: Works correctly,ui5-optionhasvaluepropertyui5-toolbar-select+ui5-toolbar-select-option: Broken, novaluepropertyOrganization
SuccessFactors
Declaration