fix: workbench 'back' blocked, workspace breadcrumb-up only when btn active
- onNavigateBack/Forward now skip entirely when currentView === 'workbench' (user relies on close button, not mouse back) - onNavigateBack inside workspace checks upBtn.disabled before clicking — in root folder (no currentPath) button exists but disabled, so navigateBack falls through to navigationStack for cross-view navigation - mouseHistoryDirection and keyHistoryDirection also block 'workbench' to prevent bypass via pointerdown/mousedown listeners
This commit is contained in:
parent
b4e66c9779
commit
0b6b0d0926
|
|
@ -86,14 +86,14 @@
|
|||
}
|
||||
|
||||
function mouseHistoryDirection(event) {
|
||||
if (currentView === 'workspace') return '';
|
||||
if (currentView === 'workspace' || currentView === 'workbench') return '';
|
||||
if (event.button === 3 || event.button === 8 || event.buttons === 8 || event.buttons === 128 || event.which === 8) return 'back';
|
||||
if (event.button === 4 || event.button === 9 || event.buttons === 16 || event.buttons === 256 || event.which === 9) return 'forward';
|
||||
return '';
|
||||
}
|
||||
|
||||
function keyHistoryDirection(event) {
|
||||
if (currentView === 'workspace') return '';
|
||||
if (currentView === 'workspace' || currentView === 'workbench') return '';
|
||||
const key = event.key || '';
|
||||
if (event.altKey && key === 'ArrowLeft') return 'back';
|
||||
if (event.altKey && key === 'ArrowRight') return 'forward';
|
||||
|
|
@ -216,9 +216,10 @@
|
|||
}
|
||||
|
||||
function onNavigateBack(e) {
|
||||
if (currentView === 'workbench') return;
|
||||
if (currentView === 'workspace') {
|
||||
const upBtn = document.querySelector('[data-files-action="up"]');
|
||||
if (upBtn) {
|
||||
if (upBtn && !upBtn.disabled) {
|
||||
upBtn.click();
|
||||
e?.preventDefault?.();
|
||||
return;
|
||||
|
|
@ -228,9 +229,10 @@
|
|||
}
|
||||
|
||||
function onNavigateForward(e) {
|
||||
if (currentView === 'workbench') return;
|
||||
if (currentView === 'workspace') {
|
||||
const fwdBtn = document.querySelector('[data-files-action="forward"]');
|
||||
if (fwdBtn) {
|
||||
if (fwdBtn && !fwdBtn.disabled) {
|
||||
fwdBtn.click();
|
||||
e?.preventDefault?.();
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue