electron/docs
Samuel Attard 49aba471dc
feat: add support for associating a Menu with a WebFrameMain (#45138)
* feat: add support for associating a Menu with a WebFrameMain

This allows certain OS level features to activate such as Writing Tools, Autofill.. and Services.

There appears to be a bug in macOS where the responder chain isn't traversed if the menu is not popped up using an event, as such we spoof a fake mouse event at the write coordinates in the right window and use that to open the menu.

* build: fix build on non-mac

* build: oops missed a header

* fix: safely handle optional T* by checking nullptr too

* build: fix gn check and build errors

* docs: suggested changes

* feat: default `frame` to `window.webContents.mainFrame` when possible

* fix: avoid deref nullptr view

* Revert "feat: default `frame` to `window.webContents.mainFrame` when possible"

This reverts commit 2e888368199317d67f6ad931a7e9eff0295c4b1b.

* fix: lint

* Remove redundant scoped objects

This code, including the comments, matches almost exactly the behavior of this argument to the function.

* Add ScopedPumpMessagesInPrivateModes patch

* More null pointer safety

---------

Co-authored-by: clavin <clavin@electronjs.org>
2025-03-28 11:50:07 -07:00
..
api feat: add support for associating a Menu with a WebFrameMain (#45138) 2025-03-28 11:50:07 -07:00
development chore: emphasize documentation style guide (#45639) 2025-03-06 17:17:06 +01:00
fiddles docs: use optional chaining for app.dock (#46119) 2025-03-19 18:34:03 -05:00
images fix: Revert "feat: Corner Smoothing CSS rule" (#46231) 2025-03-24 20:36:49 +01:00
tutorial docs: use optional chaining for app.dock (#46119) 2025-03-19 18:34:03 -05:00
api-history.schema.json docs: api history (#42982) 2024-08-19 11:17:10 -07:00
breaking-changes.md fix: hard crash on invalid command line switches (#46004) 2025-03-26 08:14:03 -05:00
experimental.md docs: fix apostrophe typo "Electrons" -> "Electron's" (#44516) 2024-11-02 15:52:22 -05:00
faq.md chore: extend linting of code blocks in the docs (#40245) 2023-11-21 16:50:08 +09:00
glossary.md docs: update docs.microsoft.com links to learn.microsoft.com (#37707) 2023-03-29 12:16:44 +02:00
README.md fix: Revert "feat: Corner Smoothing CSS rule" (#46231) 2025-03-24 20:36:49 +01:00
why-electron.md fix: fix typo in docs why-electron.md (#45437) 2025-02-05 09:26:47 -06:00

Official Guides

Please make sure that you use the documents that match your Electron version. The version number should be a part of the page URL. If it's not, you are probably using the documentation of a development branch which may contain API changes that are not compatible with your Electron version. To view older versions of the documentation, you can browse by tag on GitHub by opening the "Switch branches/tags" dropdown and selecting the tag that matches your version.

FAQ

There are questions that are asked quite often. Check this out before creating an issue:

Guides and Tutorials

Getting started

Learning the basics

Advanced steps

Detailed Tutorials

These individual tutorials expand on topics discussed in the guide above.


API References

Custom DOM Elements:

Modules for the Main Process:

Modules for the Renderer Process (Web Page):

Modules for Both Processes:

Development

See development/README.md