{"publisher":"WESWOO","measured_on":"2026-11-24","id":"accessible-dialogs","url":"https://www.weswoo.com/guides/modules/delivery/?module=accessible-dialogs#accessible-dialogs","runtime":"Chrome 157.0.8103.79","method":{"zh":"WESWOO 在独立 Chrome 中运行本条目的公开脚本，按下述条件提供最小页面与样例记录。","en":"WESWOO ran this entry’s published script in standalone Chrome with the fixture markup and records described here."},"action":{"zh":"打开帮助弹窗，比较刚打开和按关闭后的“是否开启 / 焦点所在”。","en":"Compare open state / focus location just after opening help and after pressing Close."},"source_file":"assets/ww-help-dialog.js","source_sha256":"7c752ee3cc10b76ea7f86078aac0fdb43fd2afd1b7c56f71da7b3d0952e34a6a","fixture_html":"<button id=open>Help</button><dialog><button data-close>Close</button></dialog>","readings":["true / dialog","false / trigger"],"replay_function":"async function compare({id,code,dep,fixture,variant}){\n const blob=code=>URL.createObjectURL(new Blob([code],{type:'text/javascript'})),d=blob(dep),url=blob(code.replace(\"'./ww-dialog-controller.js'\",JSON.stringify(d))),m=await import(url);\n const root=document.querySelector('main');root.innerHTML=fixture;\n const el=s=>root.querySelector(s),wait=ms=>new Promise(r=>setTimeout(r,ms));let result;\n switch(id){\n case 'accessible-dialogs':{const trigger=el('#open');m.bindHelpDialog(trigger,el('dialog'));trigger.focus();trigger.click();if(variant){el('[data-close]').click();await wait(60);}result=el('dialog').open+' / '+(document.activeElement===trigger?'trigger':'dialog');break;}\n\n }\n URL.revokeObjectURL(url);URL.revokeObjectURL(d);return result;\n}","usage":"Open a fresh page with a main element. Run variant=false, then true in a new page. Width is 1100 px except mobile-filter-drawer with variant=true (390 px). Height 700 px. Use https://example.invalid/collection, adding ?filter.v.option.color=blue&sort_by=price&page=2 for variant=true. Pass code from source_file and dep from assets/ww-dialog-controller.js. No shop endpoint is called.","regression_check":{"condition":"Remove the opener, close the dialog and read focus with a stable fallback supplied.","runtime":"Chrome 157.0.8103.79","previous_source_sha256":"4251abc4c16db8522374c1185289be5439c8db238e04eabd37c687b76c6a2004","previous_result":"body","current_source_sha256":"7c752ee3cc10b76ea7f86078aac0fdb43fd2afd1b7c56f71da7b3d0952e34a6a","current_result":"next task"}}