Skip to content

Commit 67f14db

Browse files
committed
Use anchor tags for dashboard sidebar items
1 parent 7f1c131 commit 67f14db

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/gui/src/UI/Dashboard/UIDashboard.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ async function UIDashboard (options) {
9999
continue;
100100
}
101101
const isActive = i === 0 ? ' active' : '';
102-
h += `<div class="dashboard-sidebar-item${isActive}" data-section="${tab.id}" data-tooltip="${html_encode(tab.label)}">`;
102+
const tabHash = tab.id === 'home' ? '' : `#${tab.id}`;
103+
const tabHref = tabHash || window.location.pathname;
104+
h += `<a class="dashboard-sidebar-item allow-native-ctxmenu${isActive}" href="${tabHref}" data-section="${tab.id}" data-tooltip="${html_encode(tab.label)}">`;
103105
h += tab.icon;
104106
h += tab.label;
105-
h += '</div>';
107+
h += '</a>';
106108
}
107109
h += '</div>';
108110

@@ -391,7 +393,8 @@ async function UIDashboard (options) {
391393
window.addEventListener('popstate', handleRouteChange);
392394

393395
// Sidebar item click handler
394-
$el_window.on('click', '.dashboard-sidebar-item', function () {
396+
$el_window.on('click', '.dashboard-sidebar-item', function (e) {
397+
e.preventDefault();
395398
const $this = $(this);
396399
const section = $this.attr('data-section');
397400

src/gui/src/css/dashboard.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ body {
352352
cursor: pointer;
353353
font-size: 14px;
354354
color: var(--dashboard-text);
355+
text-decoration: none;
355356
transition: background-color 0.15s;
356357
flex-shrink: 0;
357358
}

0 commit comments

Comments
 (0)