Skip to content

Commit

Permalink
Fix 'selected' value for top-level menu
Browse files Browse the repository at this point in the history
  • Loading branch information
tiliv committed Apr 30, 2024
1 parent 4f44dc8 commit de18b77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/DisplayMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export default function DisplayMenu({
setSelected((selected) => {
const option = options[selected];
if (!option.items && !option.text) {
const topOption = menus[0].items[menus[0].selected];
const _selected = isNaN(menus[0].selected) ? selected : menus[0].selected;
const topOption = menus[0].items[_selected];
const eventNames = { Load: 'load' };
const event = new CustomEvent(
eventNames[topOption.name] || topOption.name,
Expand Down

0 comments on commit de18b77

Please sign in to comment.