Commit aa8598eb authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

Crostini WebUI Installer: handle <esc> key and focus install button by default

Bug: 929571
Test: Enable CrostiniWebUIInstaller flag, and test manually
Change-Id: I890d5154e570c0b9f3bd59173f2696cba0211ede
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1874073Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Auto-Submit: Jason Lin <lxj@google.com>
Cr-Commit-Position: refs/heads/master@{#709798}
parent 122062be
......@@ -87,6 +87,15 @@ Polymer({
}),
callbackRouter.onCanceled.addListener(() => this.closeDialog_()),
];
document.addEventListener('keyup', event => {
if (event.key == 'Escape') {
this.onCancelButtonClick_();
event.preventDefault();
}
});
this.$$('.action-button').focus();
},
/** @override */
......@@ -118,6 +127,10 @@ Polymer({
case State.ERROR:
this.closeDialog_();
break;
case State.CANCELING:
// Although cancel button has been disabled, we can reach here if users
// press <esc> key.
break;
default:
assertNotReached();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment