Commit 31f1f7d3 authored by kristipark's avatar kristipark Committed by Commit Bot

[NTP] Fix cancel button submitting when adding custom link

"Cancel" was calling the form's submit event, which triggered the add
link flow.

Bug: 874018
Change-Id: Iad822d3884484f5dc0d9f3e6667c9d4c9e0a2728
Reviewed-on: https://chromium-review.googlesource.com/1174908Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Kristi Park <kristipark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583004}
parent dc4873aa
...@@ -337,10 +337,10 @@ function init() { ...@@ -337,10 +337,10 @@ function init() {
}); });
$(IDS.DELETE).addEventListener('click', deleteLink); $(IDS.DELETE).addEventListener('click', deleteLink);
$(IDS.CANCEL).addEventListener('click', closeDialog); $(IDS.CANCEL).addEventListener('click', closeDialog);
$(IDS.DONE).addEventListener('click', finishEditLink);
$(IDS.FORM).addEventListener('submit', (event) => { $(IDS.FORM).addEventListener('submit', (event) => {
// Prevent the form from submitting and modifying the URL. // Prevent the form from submitting and modifying the URL.
event.preventDefault(); event.preventDefault();
finishEditLink();
}); });
let finishEditOrClose = (event) => { let finishEditOrClose = (event) => {
if (event.keyCode === KEYCODES.ENTER) { if (event.keyCode === KEYCODES.ENTER) {
......
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