[Feature Request]: `focus` method of components that use ItemNavigation should focus one of the items
@dobrinyonkov is already working on this.
Since Jun 27, 2025.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 285
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 59
Description
Feature Request Description
It would be great if the focus() function could restore focus to the previously focused element, or apply it to the appropriate one, in components that use item navigation.
Since item navigation dynamically manages the tabindex of HTML elements within the component, implementing this behavior would significantly enhance usability.
Similar to the List control in OpenUI5, calling focus() should focus either the first item in the list or the last focused item, if one exists.
You can observe the behavior of the List control here: https://stackblitz.com/edit/vitejs-vite-tj5gsxzc?file=index.html
Expected behavior:
When focus() is called on a component with item navigation, it should correctly apply focus to the element that was previously focused.
Components that require attention:
- compat/Table
- MediaGallery - https://github.com/SAP/ui5-webcomponents/pull/11869
- ProductSwitch - https://github.com/SAP/ui5-webcomponents/pull/11762
- SideNavigation
- Timeline
- Wizard - https://github.com/UI5/webcomponents/pull/12668
- AvatarGroup - https://github.com/SAP/ui5-webcomponents/pull/11762
- Breadcrumbs - https://github.com/SAP/ui5-webcomponents/pull/11869
- CalendarLegend
- ColorPalette
- List - https://github.com/SAP/ui5-webcomponents/pull/11486
- MenuItem
- SegmentedButton
- TabContainer
- Tokenizer - https://github.com/UI5/webcomponents/pull/12713
Proposed Solution
Implement getFocusDomRef as follows:
getFocusDomRef(): HTMLElement | undefined {
return this._itemNavigation._getCurrentItem();
}
Proposed Alternatives
No response
Organization
SAP
Additional Context
No response
Priority
Low
Privacy Policy
- I’m not disclosing any internal or sensitive information.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.