Skip to content

Commit

Permalink
poll_widget: Use e.key instead of deprecated e.keyCode.
Browse files Browse the repository at this point in the history
Tested by making sure Enter and Escape work for editing poll title
and adding new poll options.
  • Loading branch information
priyank-p authored and timabbott committed Jun 2, 2021
1 parent c292ade commit 121e21d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions static/js/poll_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ export function activate({
elem.find("input.poll-question").on("keydown", (e) => {
e.stopPropagation();

if (e.keyCode === 13) {
if (e.key === "Enter") {
submit_question();
return;
}

if (e.keyCode === 27) {
if (e.key === "Escape") {
abort_edit();
return;
}
Expand Down Expand Up @@ -159,12 +159,12 @@ export function activate({
elem.find("input.poll-option").on("keydown", (e) => {
e.stopPropagation();

if (e.keyCode === 13) {
if (e.key === "Enter") {
submit_option();
return;
}

if (e.keyCode === 27) {
if (e.key === "Escape") {
$("input.poll-option").val("");
return;
}
Expand Down

0 comments on commit 121e21d

Please sign in to comment.