Skip to content

Commit b8df9f7

Browse files
chore(UserMenuItem): make submenu selection not removable
1 parent e22202c commit b8df9f7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/fiori/src/UserMenuItem.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ class UserMenuItem extends MenuItem {
5959
return this.items.filter(isInstanceOfMenuItem);
6060
}
6161

62+
/**
63+
* Overrides the base MenuItem behavior to prevent unchecking
64+
* the currently checked item in single-select mode,
65+
* ensuring there is always a selection.
66+
*/
67+
_updateCheckedState() {
68+
if (this._checkMode === MenuItemGroupCheckMode.Single && this.checked) {
69+
return;
70+
}
71+
super._updateCheckedState();
72+
}
73+
6274
/**
6375
* Returns the text of the currently checked sub-item.
6476
* Only returns text for single-select groups.

0 commit comments

Comments
 (0)