← Commit history

settings modal opens at top

John Lauer ·4cd267f3aa ·1mo ago ·parent 768a5a5
2 files changed +8−2
bin/fusion-dashboard
⋯ 1 unchanged line ⋯
dashboard/ui/index.html+8−2
@@ -158,7 +158,7 @@ dialog.settings{max-width:560px;max-height:70vh;overflow:auto;padding:18px}   <div id="prompts"></div> </main> -<dialog id="dlgSettings" class="settings">+<dialog id="dlgSettings" class="settings" tabindex="-1">   <h2 style="margin:0 0 14px">Fusion Dashboard Settings</h2>    <div class="settings-card">@@ -300,7 +300,13 @@ $('#btnSettings').onclick=async()=>{   $('#stBadge').className='card-status'+(bd?' ok':'');   $('#inpPart').value=dashSettings.demoPart||'aravk/in-s63btg';   $('#stPart').textContent=(dashSettings.demoPart||'').split('/').pop().toUpperCase();-  $('#dlgSettings').showModal();+  const dlg=$('#dlgSettings');+  dlg.showModal();+  // showModal() autofocuses the first focusable child; ours is the wiki-part INPUT in the last+  // card, so the modal opened scrolled to the bottom. Focus the dialog itself and pin to top.+  dlg.focus();+  dlg.scrollTop=0;+  requestAnimationFrame(()=>{dlg.scrollTop=0;}); }; $('#btnCloseSettings').onclick=()=>$('#dlgSettings').close(); function wireToggle(sel,actionName,label){$(sel).onclick=async(e)=>{