mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 07:47:23 +01:00
feat: enhance sidebar toggle accessibility with aria attributes for unread session count
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -304,6 +304,7 @@ class SidebarToggleActionViewItem extends ActionViewItem {
|
|||||||
|
|
||||||
// Add badge element for unread session count
|
// Add badge element for unread session count
|
||||||
this._countBadge = append(container, $('span.sidebar-toggle-badge'));
|
this._countBadge = append(container, $('span.sidebar-toggle-badge'));
|
||||||
|
this._countBadge.setAttribute('aria-hidden', 'true');
|
||||||
this._updateBadge();
|
this._updateBadge();
|
||||||
|
|
||||||
// Single autorun that tracks all badge-relevant state:
|
// Single autorun that tracks all badge-relevant state:
|
||||||
@@ -342,6 +343,16 @@ class SidebarToggleActionViewItem extends ActionViewItem {
|
|||||||
} else {
|
} else {
|
||||||
this._countBadge.style.display = 'none';
|
this._countBadge.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update accessible label to include unread count for screen readers
|
||||||
|
if (this.label) {
|
||||||
|
const baseLabel = this.action.label || localize('toggleSidebarA11y', "Toggle Primary Side Bar");
|
||||||
|
if (unreadCount > 0 && !sidebarVisible) {
|
||||||
|
this.label.setAttribute('aria-label', localize('toggleSidebarUnread', "{0}, {1} unread session(s)", baseLabel, unreadCount));
|
||||||
|
} else {
|
||||||
|
this.label.setAttribute('aria-label', baseLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _countUnreadSessions(): number {
|
private _countUnreadSessions(): number {
|
||||||
|
|||||||
Reference in New Issue
Block a user