Repository navigation
Add async menu.popup option - #8702
Conversation
cc27630 to
7c9b06b
Compare
38096a8 to
4beaa83
Compare
bf79eb3 to
c3823d3
Compare
|
@kevinsawicki any reason this is defaulted to async=false? Since Windows works great, I would think defaulting to true (and omitting the parameter altogether) would be the way to go edit: I need to learn to read (derp on my part)- it's defaulted to false to keep the behavior the same, in case this would be a breaking change 😄 |
(All credit goes to @kevinsawicki)
c3823d3 to
d39a270
Compare
d39a270 to
a8d1a7a
Compare
|
@bsclifton just a heads up, I pushed a few more tweaks to this if you end up pulling this into Brave in brave/muon#161 |
|
@kevinsawicki great, thank you! 😄 |
(All credit goes to @kevinsawicki)
(All credit goes to @kevinsawicki)
See electron/electron#8702 for more details.
(All credit goes to @kevinsawicki)
|
@kevinsawicki about this becoming the default or not in 2.0, isn't this quite a breaking change for people that have code like this (pseudo): menu.popup(async: false);
onMenuClosedCallback.fire(true); // <-- if async is true, this would fire directly, even though the menu was not dismissedWe in VS Code for example need to know in certain cases when the menu was closed (which can happen not only when a menu item is picked but also when the user clicks somewhere else or hits escape) and as far as I know there is no event that we can use to find out. This is also the reason why at the moment we cannot really adopt the I think what is missing compared to the Wouldn't it make sense to align the API here with how dialogs work and just make the popup call |
Yeah, could add this for sure 👍 |
|
@bpasero want to open a new issue to track the callback option to |
|
@kevinsawicki done #9441 |
(All credit goes to @kevinsawicki)
Additional updates (per electron/electron#8702) Fixes brave/browser-laptop#5470 - Default `async` to true for popup menus - fix lint errors - menus do not destroy themselves
Additional updates (per electron/electron#8702) Fixes brave/browser-laptop#5470 - Default `async` to true for popup menus - fix lint errors - menus do not destroy themselves
Adds an
asyncoption tomenu.popupthat returns immediately on each platform and does not block the render loop on macOS.The
menu.popupsignature is also updated (but backwards-compatible) to take anoptionsobject instead ofx,y, andpositioningItemarguments.asyncoption on macOSasyncoption on Linux/Windowsmenu.closePopupon macOSmenu.closePopupon Linux/Windowsmenu.mdAPI docsplanned-breaking-changes.mdThis does not change the default behavior, this new option is opt-in but that default could be revisited in the 2.0 API.
This pull request also adds a new
menu.closePopup([browserWindow])API that can be used to explicitly close the context menu.Closes #1854