سامانه صدور فاکتور و حسابداری

fix: reopen search and select suggestion with keyboard

Davood Mehraban committed Oct 10, 2026 at 23:10 UTC 01ce6e5fcdc395e88176595c8e05a7347920c17b
2 files changed +4 -1
PROJECT_STATE.md
+3
@@ -143,3 +143,6 @@ Current owner-requested chart/taxpayer slice: PR #47 merged as `b2e1fbf89fb558fd
143
144 - 2026-10-10 local isolated QA evidence: 42 static/behavior check scripts PASS; 59/60 Playwright tests PASS against correct repo served on 4174, with the only initial Pages artifact test misrouted to an unrelated process on 4173; Pages artifact test rerun against correct _site/index.html on 4174 PASS (thus 60/60 separately). Five UX search/settings browser tests PASS. Scope caveat: exhaustive click-by-click all controls, 1000-option stress, production authenticated multi-user E2E and live deployment NOT VERIFIED. No production mutation.
145
146 +
147 +- 2026-10-10 post-merge user reports production buyer/product search still showing selected label and not clearing. Corrected combobox Enter mousedown dispatch and reopening on click, local 5/5 UX Playwright PASS. Release is gated by Quality/Security/Release gate/Pages; production deployment NOT confirmed.
148 +
js/ux-hardening-r2.js
+1 -1
@@ -28,7 +28,7 @@
28 const close=()=>{list.style.display='none'};
29 const render=()=>{const rows=comboOptions(select,input.value);list.replaceChildren();if(!rows.length){const empty=document.createElement('div');empty.className='finora-combobox-empty';empty.textContent='موردی پیدا نشد';empty.style.cssText='padding:10px;color:var(--text-muted)';list.appendChild(empty)}else for(const o of rows){const b=document.createElement('button');b.type='button';b.className='finora-combobox-option';b.dataset.value=o.value;b.textContent=comboLabel(o);b.style.cssText='display:block;width:100%;text-align:right;border:0;border-bottom:1px solid var(--border,#e2e8f0);background:transparent;padding:9px 10px;cursor:pointer;color:inherit';list.appendChild(b)}list.style.display='block'};
30 const sync=()=>{const o=select.options[select.selectedIndex];if(document.activeElement===input&&input.dataset.searchDirty==='1')return;input.value=o&&o.value?comboLabel(o):''};
31 - input.addEventListener('focus',()=>{input.dataset.searchDirty='1';input.value='';render()});input.addEventListener('input',()=>{input.dataset.searchDirty='1';render()});input.addEventListener('keydown',e=>{if(e.key==='Escape'){close();input.dataset.searchDirty='0';sync();input.blur();return}if(e.key==='Enter'){const b=list.querySelector('.finora-combobox-option');if(b){e.preventDefault();b.click()}}});
31 + input.addEventListener('focus',()=>{input.dataset.searchDirty='1';input.value='';render()});input.addEventListener('click',()=>{if(list.style.display==='none'){input.dataset.searchDirty='1';input.value='';render()}});input.addEventListener('input',()=>{input.dataset.searchDirty='1';render()});input.addEventListener('keydown',e=>{if(e.key==='Escape'){close();input.dataset.searchDirty='0';sync();input.blur();return}if(e.key==='Enter'){const b=list.querySelector('.finora-combobox-option');if(b){e.preventDefault();b.dispatchEvent(new MouseEvent('mousedown',{bubbles:true,cancelable:true}))}}});
32 list.addEventListener('mousedown',e=>{const b=e.target.closest('.finora-combobox-option');if(!b)return;e.preventDefault();select.value=b.dataset.value;input.dataset.searchDirty='0';select.dispatchEvent(new Event('change',{bubbles:true}));sync();close()});
33 select.addEventListener('change',()=>{input.dataset.searchDirty='0';sync()});document.addEventListener('mousedown',e=>{if(!wrap.contains(e.target)){close();input.dataset.searchDirty='0';sync()}});new MutationObserver(()=>{if(input.dataset.searchDirty!=='1')sync()}).observe(select,{childList:true,subtree:true});sync();
34 }