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
16 changes: 16 additions & 0 deletions TablePro/Views/Main/EditorTabInteractionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal final class EditorTabInteractionView: NSView {
/// the content.
internal var onRowCountChanged: ((Int) -> Void)?

private var isResolvingAccessibilityHit = false
private var hoverTrackingArea: NSTrackingArea?
private var lastActivatedTabId: UUID?

Expand Down Expand Up @@ -110,12 +111,27 @@ internal final class EditorTabInteractionView: NSView {

/// Claims the track and nothing else, so a press on a tab is this view's and a press on the
/// new-tab button, on the band's insets or on the chrome below the track is not.
///
/// The claim is for the pointer alone. Accessibility resolves a screen point through this same
/// method, so claiming it unconditionally answered "the strip" for every tab and took all of
/// them out of reach of VoiceOver, Switch Control, Voice Control and XCUITest at once: this
/// view publishes nothing, so there was no element under a tab to speak, press or click. That
/// shipped in #2571 and turned the whole UI suite red from the commit that merged it.
override internal func hitTest(_ point: NSPoint) -> NSView? {
guard !isResolvingAccessibilityHit else { return super.hitTest(point) }
let local = convert(point, from: superview)
guard trackRect.contains(local) else { return super.hitTest(point) }
return self
}

/// Answers from the SwiftUI tree, which is where the tabs publish themselves. The pointer's
/// claim is lifted for the length of the question.
override internal func accessibilityHitTest(_ point: NSPoint) -> Any? {
isResolvingAccessibilityHit = true
defer { isResolvingAccessibilityHit = false }
return super.accessibilityHitTest(point)
}

private func tabIndex(atViewPoint point: CGPoint) -> Int? {
EditorTabRunLayoutBuilder.index(at: contentPoint(fromViewPoint: point), in: interaction.run)
}
Expand Down
4 changes: 2 additions & 2 deletions TableProUITests/EditorTabDetachUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
let target = try XCTUnwrap(tabLabels(in: window).last)
tab(named: target, in: window).rightClick()

let item = app.menuItems["Move Tab to New Window"]
let item = app.menuItems.matching(identifier: "Move Tab to New Window").firstMatch
XCTAssertTrue(item.waitToExist(timeout: 5), "The command must be listed")
XCTAssertTrue(item.isEnabled, "It must be offered on an idle tab among others")
app.typeKey(XCUIKeyboardKey.escape, modifierFlags: [])
Expand All @@ -90,9 +90,9 @@

private func detach(tabNamed name: String, in window: XCUIElement, of app: XCUIApplication) {
let target = tab(named: name, in: window)
XCTAssertTrue(waitUntilHittable(target, timeout: 20), "The tab must be hittable")

Check failure on line 93 in TableProUITests/EditorTabDetachUITests.swift

View workflow job for this annotation

GitHub Actions / UI tests 2/3

testClosingTheDetachedWindowLeavesTheOriginalWorking, XCTAssertTrue failed - The tab must be hittable

Check failure on line 93 in TableProUITests/EditorTabDetachUITests.swift

View workflow job for this annotation

GitHub Actions / UI tests 2/3

testClosingTheDetachedWindowLeavesTheOriginalWorking, XCTAssertTrue failed - The tab must be hittable

Check failure on line 93 in TableProUITests/EditorTabDetachUITests.swift

View workflow job for this annotation

GitHub Actions / UI tests 0/3

testMoveTabToNewWindowTakesTheTabOutOfTheStrip, XCTAssertTrue failed - The tab must be hittable

Check failure on line 93 in TableProUITests/EditorTabDetachUITests.swift

View workflow job for this annotation

GitHub Actions / UI tests 0/3

testMoveTabToNewWindowTakesTheTabOutOfTheStrip, XCTAssertTrue failed - The tab must be hittable
target.rightClick()
let item = app.menuItems["Move Tab to New Window"]
let item = app.menuItems.matching(identifier: "Move Tab to New Window").firstMatch
XCTAssertTrue(item.waitToExist(timeout: 5), "The command must be listed")
item.click()
}
Expand Down
Loading