Skip to content

fix(WMenu): removeItem() selects wrong item when currently-selected item is removed#247

Open
saddamr3e wants to merge 1 commit into
emweb:masterfrom
saddamr3e:fix/wmenu-remove-current-selection
Open

fix(WMenu): removeItem() selects wrong item when currently-selected item is removed#247
saddamr3e wants to merge 1 commit into
emweb:masterfrom
saddamr3e:fix/wmenu-remove-current-selection

Conversation

@saddamr3e

@saddamr3e saddamr3e commented Jun 17, 2026

Copy link
Copy Markdown

While testing WMenuItem::setContents(), I noticed that updating the contents of the currently selected menu item changes the active selection.

The reason is that WMenu::removeItem() treats removal of the current item the same way as removing an item before it. As a result, the previous menu item becomes selected automatically, even though only the contents of the current item are being updated.

This change clears the selection when the current item is removed instead of selecting the previous item. The existing behavior for removing items before the current selection is unchanged.

I also added a regression test to cover this case and prevent it from happening again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant