fix: delete confirm dialog never visible + race condition
- Add missing .confirm-dialog.active { display: flex; opacity: 1 } CSS rule.
The confirm dialog was created with display:none and the .active class
was added, but no CSS rule changed it to visible — so the user never
saw the confirmation prompt and delete appeared to do nothing.
- Capture file/folder target before closeContextMenu in delete handlers
to prevent null reference race condition (same as rename/share fix).
This commit is contained in:
@@ -2489,6 +2489,11 @@ select:focus {
|
|||||||
animation: modalFadeIn 0.2s ease;
|
animation: modalFadeIn 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.confirm-dialog.active {
|
||||||
|
display: flex;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.confirm-dialog-content {
|
.confirm-dialog-content {
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
|
|||||||
@@ -70,13 +70,11 @@ const contextMenus = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('delete-folder-option').addEventListener('click', async () => {
|
document.getElementById('delete-folder-option').addEventListener('click', async () => {
|
||||||
if (window.app.contextMenuTargetFolder) {
|
const folder = window.app.contextMenuTargetFolder;
|
||||||
await window.fileOps.deleteFolder(
|
|
||||||
window.app.contextMenuTargetFolder.id,
|
|
||||||
window.app.contextMenuTargetFolder.name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
window.ui.closeContextMenu();
|
window.ui.closeContextMenu();
|
||||||
|
if (folder) {
|
||||||
|
await window.fileOps.deleteFolder(folder.id, folder.name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// File context menu options
|
// File context menu options
|
||||||
@@ -174,13 +172,11 @@ const contextMenus = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('delete-file-option').addEventListener('click', async () => {
|
document.getElementById('delete-file-option').addEventListener('click', async () => {
|
||||||
if (window.app.contextMenuTargetFile) {
|
const file = window.app.contextMenuTargetFile;
|
||||||
await window.fileOps.deleteFile(
|
|
||||||
window.app.contextMenuTargetFile.id,
|
|
||||||
window.app.contextMenuTargetFile.name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
window.ui.closeFileContextMenu();
|
window.ui.closeFileContextMenu();
|
||||||
|
if (file) {
|
||||||
|
await window.fileOps.deleteFile(file.id, file.name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Rename dialog events
|
// Rename dialog events
|
||||||
|
|||||||
Reference in New Issue
Block a user