Clicking NSTokenField completion closes Safari Extension's popup window

We have a native safari extension for macOS with an NSTokenField and completions. When clicking one of the completions in the list, the window for the extension closes as though you had clicked outside of it, even if you click in the portion that intersects the popup.

If I run the extension as a regular app, the issue doesn't happen. The click registers and adds the token from the completion list.

I filed feedback (FB12606023), but need to fix the issue also. Is this somehow expected in a popup?

Video of the issue

https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExdTNpcXk1NXZtMHY0ZWdrbjAxejc1eXlpbjRkNHBnZ2R2cGhpdmQ1cSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/AkWhUFUXpHcxNYCQz5/giphy.gif

Thank you for the feedback report! Is it possible to include a sample project and steps to reproduce this?

@bweinstein I guess it's not expected behavior then. I verified the issue doesn't happen when running as a sheet in a normal app also. I uploaded our project in the feedback.

I'd love to know if there's an easy fix!

Clicking NSTokenField completion closes Safari Extension's popup window
 
 
Q