improve UX: close button closes settings panel first, then modal on second click
This commit is contained in:
parent
f304b6f634
commit
a991ca4626
1 changed files with 17 additions and 5 deletions
|
|
@ -221,11 +221,7 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
const closeBtn = document.createElement("button");
|
||||
closeBtn.textContent = "✕";
|
||||
closeBtn.className = "uncloseai-btn-close";
|
||||
closeBtn.onclick = () => {
|
||||
modal.close();
|
||||
document.body.removeChild(modal);
|
||||
uncloseaiEmbeddedModalOpen = false;
|
||||
};
|
||||
// Close button handler will be set after settings panel is created
|
||||
|
||||
// Add settings/menu button
|
||||
const menuBtn = document.createElement("button");
|
||||
|
|
@ -590,6 +586,22 @@ async function openUncloseaiEmbeddedModalNew() {
|
|||
localStorage.setItem("hermesSettingsOpen", settingsOpen.toString());
|
||||
};
|
||||
|
||||
// Set close button handler now that settings panel is available
|
||||
closeBtn.onclick = () => {
|
||||
// If settings panel is open, close it first
|
||||
if (settingsOpen) {
|
||||
settingsOpen = false;
|
||||
settingsPanel.classList.toggle("open", settingsOpen);
|
||||
localStorage.setItem("hermesSettingsOpen", settingsOpen.toString());
|
||||
return; // Don't close modal yet
|
||||
}
|
||||
|
||||
// Settings closed or not open, close the modal
|
||||
modal.close();
|
||||
document.body.removeChild(modal);
|
||||
uncloseaiEmbeddedModalOpen = false;
|
||||
};
|
||||
|
||||
// Quick action buttons
|
||||
const controls = document.createElement("div");
|
||||
controls.className = "uncloseai-modal-controls";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue