diff --git a/page/copylink.js b/page/copylink.js index 41b98c3..22540fd 100644 --- a/page/copylink.js +++ b/page/copylink.js @@ -6,7 +6,19 @@ window.addEventListener("load", function(event){ let copylink_button_list = document.getElementsByClassName("copylink"); for(let one_copylink_button of copylink_button_list){ // register onclick function - one_copylink_button.onclick = function(event){ copylink_click(this, event) }; + one_copylink_button.onclick = function(event){ + event.stopPropagation(); + copylink_click(this); + }; + + // also allow enter press + one_copylink_button.onkeypress = function(event){ + if(event.key === "Enter"){ + event.preventDefault(); + event.stopPropagation(); + copylink_click(event.target); + } + }; // add descriptive title one_copylink_button.title = copylink_hint_text; @@ -20,8 +32,7 @@ window.addEventListener("load", function(event){ * * @param self Copylink button element. */ -async function copylink_click(self, event){ - event.stopPropagation(); +async function copylink_click(self){ let success = true; // RETRIEVE SECTION ID //