Skip to content

Commit 20c3764

Browse files
authored
Disable search in multiple select field for Other Options field when not selected (#3500)
Improve Option field
1 parent de9077a commit 20c3764

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/js/tabs/firmware_flasher.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,19 @@ firmware_flasher.initialize = function (callback) {
431431
$('select[name="radioProtocols"]').select2();
432432
$('select[name="telemetryProtocols"]').select2();
433433
$('select[name="motorProtocols"]').select2();
434-
$('select[name="options"]').select2({ closeOnSelect: false });
434+
$('select[name="options"]').select2({ tags: false, closeOnSelect: false });
435435
$('select[name="commits"]').select2({ tags: true });
436436

437+
$('select[name="options"]')
438+
.on('select2:opening', function() {
439+
const searchfield = $(this).parent().find('.select2-search__field');
440+
searchfield.prop('disabled', false);
441+
})
442+
.on('select2:closing', function() {
443+
const searchfield = $(this).parent().find('.select2-search__field');
444+
searchfield.prop('disabled', true);
445+
});
446+
437447
$('select[name="radioProtocols"]').on("select2:select", function() {
438448
const selectedProtocol = $('select[name="radioProtocols"] option:selected').first().val();
439449
if (selectedProtocol) {
@@ -502,6 +512,7 @@ firmware_flasher.initialize = function (callback) {
502512
'select[name="options"]',
503513
'select[name="commits"]',
504514
];
515+
505516
$(document).on('select2:open', select2Elements.join(','), () => {
506517
const allFound = document.querySelectorAll('.select2-container--open .select2-search__field');
507518
$(this).one('mouseup keyup', () => {

0 commit comments

Comments
 (0)