From: Ardis Lu Date: Mon, 3 Oct 2022 07:21:30 +0000 (-0700) Subject: Fix double dialog when clicking on upload label X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=8de6f0571ec2ad95a9c548776e04e3fc9b0535c7;p=ens2hex Fix double dialog when clicking on upload label Clicking an input's label is equal to clicking the input itself. So .stopPropagation() needs to be applied to the label as well as the input. --- diff --git a/index.html b/index.html index 2d7a4d4..6f6d469 100644 --- a/index.html +++ b/index.html @@ -135,6 +135,7 @@ div.addEventListener('drop', e => input.files = e.dataTransfer.files); div.addEventListener('click', _ => input.click()); input.addEventListener('click', e => e.stopPropagation()); // Prevent 'click' from getting propagated to div (or else there will be two dialogs) + document.querySelector('label[for="file"]').addEventListener('click', e => e.stopPropagation()); // Implement namehash as defined in https://eips.ethereum.org/EIPS/eip-137 // Does NOT include the '0x' prefix in the return value so it can be easily passed into JSON-RPC