diff --git a/CHANGELOG.md b/CHANGELOG.md index 72e023f32..f361f6361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- VoiceOver announces the active tab title when you switch between window tabs. (#1490) - Opening a query tab no longer pulls keyboard focus away from the sidebar or another control; the editor takes focus only when nothing else holds it. VoiceOver now labels the SQL editor and the Clear and Format buttons. (#1490) - The connection form opens with the Name field focused, Return or the Down arrow in the welcome search moves to the connection list, and focus returns to the list after a sheet closes, so you can set up a connection without the mouse. (#1490) - Escape now dismisses search-based sheets and popovers (database switcher, quick switcher, column and connection pickers). Pressing Escape clears the search text first; a second Escape closes the sheet. (#1490) diff --git a/TablePro/Views/Main/Extensions/MainContentCoordinator+WindowLifecycle.swift b/TablePro/Views/Main/Extensions/MainContentCoordinator+WindowLifecycle.swift index 540cb75e2..cab08a350 100644 --- a/TablePro/Views/Main/Extensions/MainContentCoordinator+WindowLifecycle.swift +++ b/TablePro/Views/Main/Extensions/MainContentCoordinator+WindowLifecycle.swift @@ -30,6 +30,7 @@ extension MainContentCoordinator { evictionTask = nil syncSidebarToSelectedTab() + announceActiveTabToVoiceOver() Self.lifecycleLogger.debug( "[switch] coordinator.handleWindowDidBecomeKey done connId=\(self.connectionId, privacy: .public) totalMs=\(Int(Date().timeIntervalSince(t0) * 1_000))" @@ -82,6 +83,20 @@ extension MainContentCoordinator { ) } + /// Announce the active tab title to VoiceOver when the window becomes key, + /// so assistive-technology users get the same context the window title gives. + private func announceActiveTabToVoiceOver() { + guard let title = tabManager.selectedTab?.title, !title.isEmpty else { return } + NSAccessibility.post( + element: NSApp as Any, + notification: .announcementRequested, + userInfo: [ + .announcement: title, + .priority: NSAccessibilityPriorityLevel.medium.rawValue, + ] + ) + } + // MARK: - Sidebar Sync /// Update the window-scoped sidebar selection so the active table tab