feat: add support for keyboard initialized menu popup (#38903)

* feat: add support for keyboard initialized menu popup

* Update docs/api/menu.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* fix: add patch to chromium for keyboard accessibility menu behavior

* refactor: s/initiatedByKeyboard/sourceType

* fix: ignore initial mouse event to retain keyboard initiated focus

* Update docs/api/menu.md

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

---------

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
This commit is contained in:
Samuel Attard 2023-06-29 15:54:06 -07:00 committed by GitHub
parent 607e71d563
commit 499d893040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 282 additions and 33 deletions

View file

@ -80,6 +80,10 @@ The `menu` object has the following instance methods:
* `positioningItem` number (optional) _macOS_ - The index of the menu item to
be positioned under the mouse cursor at the specified coordinates. Default
is -1.
* `sourceType` string (optional) _Windows_ _Linux_ - This should map to the `menuSourceType`
provided by the `context-menu` event. It is not recommended to set this value manually,
only provide values you receive from other APIs or leave it `undefined`.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
* `callback` Function (optional) - Called when menu is closed.
Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).