Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9987,17 +9987,9 @@ enum CmuxExtensionSidebarSelection {
item.representedObject = descriptor.id
item.target = CmuxExtensionSidebarMenuTarget.shared
item.state = selectedProviderId == descriptor.id ? .on : .off
item.image = NSImage(systemSymbolName: descriptor.systemImageName, accessibilityDescription: nil)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Each new system-symbol NSImage is created with accessibilityDescription: nil, which suppresses VoiceOver from reading out the icon for assistive-technology users navigating the menu. Since the menu item already carries a localised title, screen readers will still announce the text, but providing a matching description (or reusing the item title) is the correct pattern for NSMenuItem icons.

Suggested change
item.image = NSImage(systemSymbolName: descriptor.systemImageName, accessibilityDescription: nil)
item.image = NSImage(systemSymbolName: descriptor.systemImageName, accessibilityDescription: localizedTitle(for: descriptor))

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

menu.addItem(item)
}
menu.addItem(.separator())
let manageItem = NSMenuItem(
title: String(localized: "sidebar.extensions.manage", defaultValue: "Manage Sidebar Extensions..."),
action: #selector(CmuxExtensionSidebarMenuTarget.manageExtensions(_:)),
keyEquivalent: ""
)
manageItem.representedObject = anchorView
manageItem.target = CmuxExtensionSidebarMenuTarget.shared
menu.addItem(manageItem)
menu.popUp(
positioning: nil,
at: NSPoint(x: 0, y: anchorView.bounds.maxY + 2),
Expand All @@ -10014,14 +10006,6 @@ private final class CmuxExtensionSidebarMenuTarget: NSObject {
guard let providerId = sender.representedObject as? String else { return }
CmuxExtensionSidebarSelection.setProviderId(providerId)
}

@objc func manageExtensions(_ sender: NSMenuItem) {
guard let anchorView = sender.representedObject as? NSView else { return }
AppDelegate.shared?.openSidebarExtensionBrowser(
from: anchorView,
title: String(localized: "sidebar.extensions.browser.title", defaultValue: "Sidebar Extensions")
)
}
}

@MainActor
Expand Down Expand Up @@ -13005,14 +12989,16 @@ private struct SidebarFooterButtons: View {
@ObservedObject var updateViewModel: UpdateViewModel
@ObservedObject var fileExplorerState: FileExplorerState
let onSendFeedback: () -> Void
@State private var extensionMenuAnchorView: NSView?
@State private var extensionBrowserAnchorView: NSView?

var body: some View {
HStack(spacing: 4) {
SidebarHelpMenuButton(onSendFeedback: onSendFeedback)
Button {
guard let extensionMenuAnchorView else { return }
CmuxExtensionSidebarSelection.showMenu(anchorView: extensionMenuAnchorView, event: nil)
_ = AppDelegate.shared?.openSidebarExtensionBrowser(
from: extensionBrowserAnchorView,
title: String(localized: "sidebar.extensions.browser.title", defaultValue: "Sidebar Extensions")
)
} label: {
Image(systemName: "puzzlepiece.extension")
.symbolRenderingMode(.monochrome)
Expand All @@ -13022,10 +13008,10 @@ private struct SidebarFooterButtons: View {
}
.buttonStyle(SidebarFooterIconButtonStyle())
.frame(width: 22, height: 22, alignment: .center)
.safeHelp(String(localized: "command.switchExtensionSidebar.subtitle", defaultValue: "Choose Sidebar"))
.accessibilityLabel(String(localized: "command.switchExtensionSidebar.subtitle", defaultValue: "Choose Sidebar"))
.safeHelp(String(localized: "sidebar.extensions.browser.title", defaultValue: "Sidebar Extensions"))
.accessibilityLabel(String(localized: "sidebar.extensions.browser.title", defaultValue: "Sidebar Extensions"))
.accessibilityIdentifier("SidebarExtensionMenuButton")
.background(TitlebarControlAnchorView { extensionMenuAnchorView = $0 })
.background(TitlebarControlAnchorView { extensionBrowserAnchorView = $0 })
UpdatePill(model: updateViewModel)
}
.frame(maxWidth: .infinity, alignment: .leading)
Expand Down
4 changes: 3 additions & 1 deletion Sources/Update/MinimalModeSidebarControls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,15 @@ final class MinimalModeSidebarControlActionView: NSView {
return
}
switch slot {
case .toggleSidebar:
CmuxExtensionSidebarSelection.showMenu(anchorView: self, event: event)
Comment on lines +197 to +198

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 "Manage Sidebar Extensions" inaccessible in minimal mode

After this PR the sidebar kind menu no longer contains a "Manage Extensions" entry, and the replacement path is the puzzle button in SidebarFooterButtons. That button lives inside the main sidebar panel, which is hidden in minimal mode. In minimal mode the right-click on the sidebar toggle only shows the kind selector, leaving no discoverable way to reach the Extensions browser without first switching out of minimal mode.

case .newTab:
_ = AppDelegate.shared?.showNewWorkspaceContextMenu(anchorView: self, event: event)
case .focusHistoryBack:
_ = AppDelegate.shared?.showFocusHistoryContextMenu(anchorView: self, event: event, direction: .back)
case .focusHistoryForward:
_ = AppDelegate.shared?.showFocusHistoryContextMenu(anchorView: self, event: event, direction: .forward)
case .toggleSidebar, .showNotifications:
case .showNotifications:
super.rightMouseDown(with: event)
}
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/Update/UpdateTitlebarAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,9 @@ struct TitlebarControlsView: View {
#endif
onToggleSidebar()
},
rightClickAction: nil) {
rightClickAction: { anchorView, event in
CmuxExtensionSidebarSelection.showMenu(anchorView: anchorView, event: event)
}) {
sidebarIconLabel(config: config, iconGeometryKeyPrefix: "titlebarControl_toggleSidebarIcon")
}
.safeHelp(KeyboardShortcutSettings.Action.toggleSidebar.tooltip(String(localized: "titlebar.sidebar.tooltip", defaultValue: "Show or hide the sidebar")))
Expand Down
4 changes: 2 additions & 2 deletions Sources/WindowDragHandleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,9 @@ enum MinimalModeSidebarControlActionSlot: Int, CaseIterable {

var acceptsContextMenu: Bool {
switch self {
case .newTab, .focusHistoryBack, .focusHistoryForward:
case .toggleSidebar, .newTab, .focusHistoryBack, .focusHistoryForward:
return true
case .toggleSidebar, .showNotifications:
case .showNotifications:
return false
}
}
Expand Down
Loading