Problem with NSWindowCollectionBehaviorCanJoinAllSpaces

My application sets NSCollectionBehavior for all its windows to NSWindowCollectionBehaviorCanJoinAllSpaces. The main window contains an NSBrowser view. As long as I remain in the original space where I launched my application, the browser view works correctly.


After I switch to a different space, rows in one column of the browser view do not become visible when I scroll the column vertically. Instead, rows that were scrolled out of view at the time I switched spaces appear blank when I scroll them into view in the new space. Sometimes they become visible after a little while if I jiggle the column up and down briefly in the second space, but sometimes they remain invisible no matter what I do. When I switch back to the space in which the application was originally launched, all the rows are visible and scrolling again works as expected.


Still more puzzling, this only happens in the second column of the browser view. If the third and fourth rows also have rows scrolled out of view, they scroll normally in the second space.


Is this a known issue? Is there a workaround?

Typo in the third paragraph: the last sentence should be "If the third and fourth columns also have rows scrolled out of view, they scroll normally in the second space.

I figured out that the problem is a conceptual misfit between Mission Control and the way I was trying to make my application work.


My application is UI Browser <http://pfiddlesoft.com/uibrowser>. Its browser view displays the Accessibility hierarchy of the UI elements in a selected target application. The second column always displays the open windows (and the menu bar) of the target application.


It turns out that, if an application like the Finder has windows open in multiple Mission Control spaces, UI Browser's second column only displays the windows that are open in the current space. When I switch to another space, UI Browser can no longer access the windows in the original space. So when I scroll the second column, the now inaccessible windows' titles can't be displayed because UI Browser cannot find them.


So, the next version of UI Browser (due soon) will refresh its view when the user switches spaces, so as to show only the windows that are accessible in the new space. This change will conform to the basic principle of macOS accessibility, which is that a Mac should only make visible to users with disabilities the same things that a sighted user can see, and a sighted user cannot see the windows in a space that is not currently visible.


My Mac has the Mission Control preference "Displays have separate Spaces" turned OFF. For the case of people who have it turned on and use multiple monitors, I think I should probably also stop using NSWindowCollectionBehaviorCanJoinAllSpaces and use NSWindowCollectionBehaviorMoveToActiveSpace instead.


I've been working with the macOS Accessibility API for 15 years now, and I'm still learning new stuff!

Problem with NSWindowCollectionBehaviorCanJoinAllSpaces
 
 
Q