enhance media focus handling to support sidebar opening

This commit is contained in:
Slowlife01
2025-03-18 08:56:10 +07:00
parent 5e32c09d9f
commit bfe83dd653
2 changed files with 7 additions and 2 deletions

View File

@@ -428,7 +428,10 @@ class ZenMediaController {
} }
onMediaFocus() { onMediaFocus() {
this._currentMediaController?.focus(); if (!this._currentBrowser) return;
const sidebarId = this._currentBrowser.getAttribute('zen-sidebar-id');
if (sidebarId) gZenBrowserManagerSidebar.open(sidebarId);
else this._currentMediaController?.focus();
} }
onMediaMute() { onMediaMute() {

View File

@@ -280,8 +280,10 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
this.close(); this.close();
} }
open() { open(id = null) {
let sidebar = document.getElementById('zen-sidebar-web-panel'); let sidebar = document.getElementById('zen-sidebar-web-panel');
if (id) this._currentPanel = id;
sidebar.removeAttribute('hidden'); sidebar.removeAttribute('hidden');
this.update(); this.update();
} }