# PopupMenu::show focus woes (and a workaround)

**URL:** <https://forum.juce.com/t/popupmenu-show-focus-woes-and-a-workaround/43932>\
**Category:** General JUCE discussion\
**Created:** [January 20, 2021, 1:43pm UTC](https://forum.juce.com/t/popupmenu-show-focus-woes-and-a-workaround/43932 "2021-01-20T13:43:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![asimilon](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/asimilon/32/4235_2.png) [@asimilon](https://forum.juce.com/u/asimilon)\
**Post date:** [January 20, 2021, 1:43pm UTC](https://forum.juce.com/t/popupmenu-show-focus-woes-and-a-workaround/43932/1 "2021-01-20T13:43:55Z")

</div>

I just came across a problem that I spent far too long trying to mitigate.

I have a `PopupMenu` where one of the item callbacks is giving focus to a `TextEditor`, however based on [the answer here](https://forum.juce.com/t/on-show-of-popupmenu-focus-is-given-to-popupmenu/12845) it seems that (intentionally) when the menu closes it is returning focus to whichever component had the focus when the menu was opened, which would cause the `TextEditor` I gave focus to in the item callback to be lost.

Using `showAsync` instead solved this issue completely.

edit: I also imagine that if instead of using callbacks I reacted to the result from `PopupMenu::show` and then gave `TextEditor` focus that this would have solved the problem as well.
