فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(q01): capture exact Windows modal focus failure context
davoodmehraban89 committed
Oct 30, 2026 at 23:55 UTC
43922a95882df1580def120bc34a5ea57ee6a8c9
1 file changed
+18
-1
tests/windows-vm-ui-interaction-audit-browser.js
+18
-1
@@ -183,6 +183,11 @@
183
// Cross-app dialog behavior: nested modal focus, Escape and focus return.
184
const modalTrigger=hamburger;
185
modalTrigger.focus();
186
+ // A focus-restore regression is actionable only if the trigger was
187
+ // focusable before opening any dialog. Prove this precondition in WebView2.
188
+ if (document.activeElement!==modalTrigger) {
189
+ throw Error('Q01 modal-focus setup failed: sidebar trigger cannot receive focus');
190
+ }
191
let unexpectedConfirm=false;
192
FINORA.Modal.open({title:'Q01 Synthetic outer dialog',
193
body:'<input id="q01ModalField" value="synthetic" />',
@@ -248,7 +253,19 @@
253
document.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true,cancelable:true}));
254
await wait(15);
255
if(document.querySelector('.modal-backdrop') || document.activeElement!==modalTrigger ||
251
- unexpectedConfirm) throw Error('Escape did not restore focus to original control');
256
+ unexpectedConfirm) {
257
+ const active=document.activeElement;
258
+ throw Error('Escape did not restore focus to original control: '+
259
+ JSON.stringify({
260
+ activeTag:active?.tagName||null,activeId:active?.id||null,
261
+ expectedTag:modalTrigger.tagName,expectedId:modalTrigger.id,
262
+ triggerConnected:modalTrigger.isConnected,
263
+ activeInDom:!!active?.isConnected,
264
+ remainingDialogStack:FINORA.Modal.stack.length,
265
+ remainingBackdrops:document.querySelectorAll('.modal-backdrop').length,
266
+ unexpectedConfirm
267
+ }));
268
+ }
269
// Open a fresh synthetic confirmation: a user clicking Cancel must NOT
270
// execute the callback. Deliberate Confirm should execute exactly once.
271
let syntheticConfirmed=0;