From 813b81e0f618a7aaad408199b274c71acce1896a Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 9 Jul 2026 13:06:42 -0500 Subject: [PATCH] feat: Enter auto-selects first exam match in TomSelect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onType highlights the first visible option on each keystroke so pressing Enter immediately selects it — no need to arrow-down manually. Also adds selectOnTab for the same effect with Tab key. Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/recepcion.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 10f8275..4b65694 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -1031,8 +1031,16 @@ document.addEventListener('DOMContentLoaded', () => { examTS = new TomSelect('#sel-examenes', { plugins: ['remove_button'], maxOptions: null, + selectOnTab: true, onItemAdd: () => recalcularPrecios(), onItemRemove: () => recalcularPrecios(), + onType(str) { + if (!str) return; + requestAnimationFrame(() => { + const first = examTS.dropdown_content.querySelector('.option:not(.disabled)'); + if (first) examTS.setActiveOption(first); + }); + }, render: { option(data, escape) { const consent = data['data-consent'] == '1' || data.consent == '1';