Bug 1477088 - Part 1. Force adding the focus to the button in order to handle the key event. r=birtles

The menu button can't receive the key event on macOS since macOS doesn't leave the focus of the menu button even if click the menu button.
So this patch will add the focus to the button when clicking the button.

Differential Revision: https://phabricator.services.mozilla.com/D2585

--HG--
extra : rebase_source : 0cb9064790c6d75c61fccc51b14faf6ddf00f98e
extra : amend_source : 122dbced9ac858edfb9b55fad0a2b6ad1f398b52
This commit is contained in:
Mantaroh Yoshinaga 2018-08-08 08:16:12 +09:00
Родитель 2baf8e31d6
Коммит be9e7e8e9b
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -197,6 +197,10 @@ class MenuButton extends PureComponent {
async onClick(e) {
if (e.target === this.buttonRef) {
// On Mac, even after clicking the button it doesn't get focus.
// Force focus to the button so that our keydown handlers get called.
this.buttonRef.focus();
if (this.props.onClick) {
this.props.onClick(e);
}