Skip to content

Commit c58fb5c

Browse files
Ahmet OeztuerkAhmet Oeztuerk
authored andcommitted
quick command select: prevent onmousedown event to fix double-click bug on dropdown
users had to click command selector dropdown twice to see dropdown items. first click focused on the dropdown menu , borders turning blue as if its selected, the second click actually showed the dropdown items. users could reset this focus state by clicking somewhere empty in the quick commands popup. made some changes using deepseek and tested it on Firefox 140.11.0esr and Chromium 148.0.7778.215 (Official Build) built on Debian GNU/Linux 13 (trixie) (64-bit) Deepseek explanation: - onmousedown="event.preventDefault()" — prevents the browser from starting the native <select> dropdown mechanism. The browser never tries to open its own popup or focus the element. - onclick="toggleElement(...)" — fires normally since mousedown's preventDefault doesn't block click events. The add_body_close mechanism (which is designed to work with click events) works correctly. The original onclick-only approach failed because modern Chrome/Safari intercept the click on <select> at a platform level before onclick fires. The pure onmousedown approach failed because the click event then landed on the newly-shown overlay div, confusing the body-close mechanism. This combined approach addresses both problems.
1 parent 548c3bf commit c58fb5c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

templates/_status_cmd_pane.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<th class="w-24">Command</th>
4343
<td class="relative">
4444
<input type='hidden' id="opt_persistent" name='persistent' value="comments">
45-
<select name="quick_command" id="quick_command" onChange="check_selected_command(this.value)" class="w-full" onclick="toggleElement('command_select', null, true); jQuery(this).blur(); return false;">
45+
<select name="quick_command" id="quick_command" onChange="check_selected_command(this.value)" class="w-full" onmousedown="event.preventDefault()" onclick="toggleElement('command_select', null, true); jQuery(this).blur(); return false;">
4646
[% FOREACH qc = quick_commands %]
4747
[% IF qc == "-"; NEXT; END %]
4848
[% IF !qc.defined("cls"); qc.cls = ""; END %]

0 commit comments

Comments
 (0)