refactor: Improve accessibility of menus (#15302)
* refactor: improve menubar keyboard accessibility * fix: create a temporary widget for tray icon context menu * fix: focus menu bar with Alt when autohide is off * fix: make menu bar focus work more like the native menus * fix: only focus menu bar if it's not already focused * fix: track accelerator registration to avoid duplicates * docs: add docs for & notation in app menu item names * fix: only try to activate accelerator if it's registered * fix: add friend to monitor window focus change * style: add <memory> include
This commit is contained in:
parent
00daff6ac8
commit
894ae1b3f5
13 changed files with 405 additions and 140 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "atom/browser/ui/accelerator_util.h"
|
||||
#include "ui/views/view.h"
|
||||
#include "ui/views/view_tracker.h"
|
||||
|
||||
namespace content {
|
||||
struct NativeWebKeyboardEvent;
|
||||
|
@ -34,6 +35,7 @@ class RootView : public views::View {
|
|||
bool IsMenuBarVisible() const;
|
||||
void HandleKeyEvent(const content::NativeWebKeyboardEvent& event);
|
||||
void ResetAltState();
|
||||
void RestoreFocus();
|
||||
|
||||
// views::View:
|
||||
void Layout() override;
|
||||
|
@ -57,6 +59,8 @@ class RootView : public views::View {
|
|||
// Map from accelerator to menu item's command id.
|
||||
accelerator_util::AcceleratorTable accelerator_table_;
|
||||
|
||||
std::unique_ptr<views::ViewTracker> last_focused_view_tracker_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RootView);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue