Skip to content

Commit fda7572

Browse files
authored
fix(ui5-menu): handle uncaught error on mouseout (#11122)
Previosuly when the menu opener was not being the correct type/item there was an error being thrown in the console. This was happening because in some cases (e.g menu items with subitems used in `ui5-side-navigation`) the opener of a submenu happens to be an `ui5-icon` or `<a>` tag for example. Therefore in those cases the items lacked properties (such as `associatedItem` as we can see from the screenshot below) leading to `item = undefined` We fix the problem, by assigning the correct target upon mouse out, which is handled in the `_getSubmenuReference()` method.
1 parent 4a31804 commit fda7572

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/main/src/Menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class Menu extends UI5Element {
625625

626626
_itemMouseOut(e: MouseEvent) {
627627
if (isDesktop()) {
628-
const opener = e.target as OpenerStandardListItem;
628+
const opener = e.currentTarget as OpenerStandardListItem;
629629
const item = opener.associatedItem;
630630

631631
clearTimeout(this._timeout);

0 commit comments

Comments
 (0)