Thread viewer for Bluesky

don't submit form on enter

Changed files
+12 -14
+12 -14
posting_stats_page.js
··· 142 142 /** @param {KeyboardEvent} e */ 143 143 144 144 onUserKeyDown(e) { 145 - if (this.autocomplete.style.display != 'none') { 146 - if (e.key == 'ArrowDown') { 147 - e.preventDefault(); 148 - this.moveAutocomplete(1); 149 - } else if (e.key == 'ArrowUp') { 150 - e.preventDefault(); 151 - this.moveAutocomplete(-1); 152 - } else if (e.key == 'Enter') { 153 - e.preventDefault(); 145 + if (e.key == 'Enter') { 146 + e.preventDefault(); 154 147 155 - if (this.autocompleteIndex >= 0) { 156 - this.selectUser(this.autocompleteIndex); 157 - } 158 - } else if (e.key == 'Escape') { 159 - this.hideAutocomplete(); 148 + if (this.autocompleteIndex >= 0) { 149 + this.selectUser(this.autocompleteIndex); 160 150 } 151 + } else if (e.key == 'Escape') { 152 + this.hideAutocomplete(); 153 + } else if (e.key == 'ArrowDown' && this.autocompleteResults.length > 0) { 154 + e.preventDefault(); 155 + this.moveAutocomplete(1); 156 + } else if (e.key == 'ArrowUp' && this.autocompleteResults.length > 0) { 157 + e.preventDefault(); 158 + this.moveAutocomplete(-1); 161 159 } 162 160 } 163 161