Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.0-1 at The Tor Project / Applications / Tor Browser

Commits:

2 changed files:

Changes:

  • browser/components/torconnect/content/aboutTorConnect.css
    ... ... @@ -136,6 +136,13 @@ button {
    136 136
       fill: white;
    
    137 137
     }
    
    138 138
     
    
    139
    +#cancelButton {
    
    140
    +  color: var(--in-content-button-text-color);
    
    141
    +  border: 1px solid var(--in-content-button-border-color);
    
    142
    +  border-radius: 4px;
    
    143
    +  background-color: var(--in-content-button-background);
    
    144
    +}
    
    145
    +
    
    139 146
     #locationDropdownLabel {
    
    140 147
       margin-block: auto;
    
    141 148
       margin-inline: 4px;
    

  • browser/components/torconnect/content/aboutTorConnect.js
    ... ... @@ -775,6 +775,28 @@ class AboutTorConnect {
    775 775
             this.beginAutoBootstrap(value);
    
    776 776
           }
    
    777 777
         });
    
    778
    +
    
    779
    +    // Delay the "Enter" activation of the given button from "keydown" to
    
    780
    +    // "keyup".
    
    781
    +    //
    
    782
    +    // Without this, holding down Enter will continue to trigger the button
    
    783
    +    // until the user stops holding. This means that a user can accidentally
    
    784
    +    // re-trigger a button several times. This is particularly bad when the
    
    785
    +    // focus gets moved to a new button, and the new button can get triggered
    
    786
    +    // immediately. E.g. when the "Connect" button is triggered it disappears
    
    787
    +    // and focus moves to the "Cancel" button.
    
    788
    +    for (const button of document.body.querySelectorAll("button")) {
    
    789
    +      button.addEventListener("keydown", event => {
    
    790
    +        if (event.key === "Enter") {
    
    791
    +          event.preventDefault();
    
    792
    +        }
    
    793
    +      });
    
    794
    +      button.addEventListener("keyup", event => {
    
    795
    +        if (event.key === "Enter") {
    
    796
    +          button.click();
    
    797
    +        }
    
    798
    +      });
    
    799
    +    }
    
    778 800
       }
    
    779 801
     
    
    780 802
       initObservers() {