Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Prevent Enter from performing two actions. (#3981)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba committed Jan 24, 2018
1 parent 48286d0 commit be59362
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/webextension/selector/uicontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,11 @@ this.uicontrol = (function() {
sendEvent("cancel-shot", "keyboard-escape");
exports.deactivate();
}
if ((event.key || event.code) === "Enter" && getState.state === "selected") {
// Enter to trigger Save or Download by default. But if the user tabbed to
// select another button, then we do not want this.
if ((event.key || event.code) === "Enter"
&& getState.state === "selected"
&& ui.iframe.document().activeElement.tagName === "BODY") {
if (ui.isDownloadOnly()) {
sendEvent("download-shot", "keyboard-enter");
shooter.downloadShot(selectedPos);
Expand Down

0 comments on commit be59362

Please sign in to comment.