mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +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
|
||||
this._countBadge = append(container, $('span.sidebar-toggle-badge'));
|
||||
this._countBadge.setAttribute('aria-hidden', 'true');
|
||||
this._updateBadge();
|
||||
|
||||
// Single autorun that tracks all badge-relevant state:
|
||||
@@ -342,6 +343,16 @@ class SidebarToggleActionViewItem extends ActionViewItem {
|
||||
} else {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user