fix(#4581): restore hidden Cancel button in showPromptDialog after a hideCancel confirm

Codex gate (SILENT): the new outside-symlink info dialog uses showConfirmDialog({hideCancel:true})
which sets the shared #appDialogCancel to display:none; showPromptDialog only reset textContent, so a
later rename/new-file prompt opened with no Cancel button. Fix: showPromptDialog now restores
cancelBtn.style.display='' first. + regression test.
This commit is contained in:
nesquena-hermes
2026-06-21 09:17:26 +00:00
parent 077de5455c
commit 96b5214523
2 changed files with 21 additions and 1 deletions
+7 -1
View File
@@ -5918,7 +5918,13 @@ function showPromptDialog(opts={}){
input.value=prefill;input.placeholder=opts.placeholder||'';
input.autocomplete='off';input.spellcheck=false;
}
if(cancelBtn) cancelBtn.textContent=opts.cancelLabel||t('cancel');
if(cancelBtn){
// A prior showConfirmDialog({hideCancel:true}) (e.g. the outside-symlink info
// dialog, #4581) may have hidden the shared Cancel button; always restore it
// so a subsequent prompt keeps its Cancel affordance.
cancelBtn.style.display='';
cancelBtn.textContent=opts.cancelLabel||t('cancel');
}
if(confirmBtn){
confirmBtn.textContent=opts.confirmLabel||t('create');
confirmBtn.classList.toggle('danger',!!opts.danger);
@@ -184,6 +184,20 @@ class ShowPromptDialogPrefillTests(unittest.TestCase):
break
return self.src[start:end]
def test_show_prompt_dialog_restores_hidden_cancel_button(self):
"""#4581: the outside-symlink info dialog calls showConfirmDialog with
hideCancel:true, which sets the shared #appDialogCancel button to
display:none. showPromptDialog reuses the same button, so it must restore
the display before showing — otherwise the next rename/new-file prompt
opens with no Cancel button after a user clicks an external symlink."""
body = self._slice_show_prompt_dialog()
self.assertIn(
"cancelBtn.style.display=''", body.replace(" ", ""),
"showPromptDialog must reset cancelBtn.style.display so a prior "
"showConfirmDialog({hideCancel:true}) can't leave the Cancel button "
"hidden on a subsequent prompt (#4581 regression).",
)
def test_show_prompt_dialog_accepts_default_value_alias(self):
body = self._slice_show_prompt_dialog()
# Must reference `opts.defaultValue` somewhere — the alias was the