The webextension code would need to show the overflow panel before attempting to activate the browser action of the associated extension.
Bug 1683378 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Firefox's own webextension framework code would need to show the overflow panel before attempting to activate the browser action of the associated extension.