Unhidden subview outside of superview's bounds

I’ve finally changed my main development platform to macOS 14 Sonoma and almost immediately have I encountered something I consider being a bug. I searched for similar issues, but nowhere have I found any relevant information or help.

The issue is rather funny; if you have a subview and, for whatever reason, it finds itself outside of its superview’s bounds, it remains visible, instead of being hidden. It’s like you have a window on your room wall, but still the interior of your room is visible outside of window’s borders :-)

Here’s a simple Xcode project that explains what I’m talking about:

https://zigz.ag/temp/SubviewBug/UnhiddenXcodeProject.zip

Unpack and build this project, run the test application and see it yourself.

However, there are some differences, regarding the Xcode/SDK version used to build the application and the macOS version it runs on. The project format is “Xcode 13.0” and MACOSX_DEPLOYMENT_TARGET = 13.0. Here you can find application bundle, build with Xcode 14:

https://zigz.ag/temp/SubviewBug/UnhiddenXcode14Build.zip

The relevant build parameters, as found in application's Info.plist are:

BuildMachineOSBuild: 22G605
DTPlatformVersion: 13.3
DTSDKBuild: 22E245
DTXcode: 1431
DTXcodeBuild: 14E300c

If you run it on both Ventura and Sonoma, you’ll see ti behaves as expected. However, here you can find application bundle, build with Xcode 15:

https://zigz.ag/temp/SubviewBug/UnhiddenXcode15Build.zip

The relevant build parameters, as found in application's Info.plist are:

BuildMachineOSBuild: 23D56
DTPlatformVersion: 14.2
DTSDKBuild: 23C53
DTXcode: 1520
DTXcodeBuild: 15C500b

Now, if you run this build on Ventura, you’ll see it behaves fine. Running it on Sonoma however, shows the behaviour I’m trying to explain; the ratio button titled “Two” remains visible, even though its superview shrinks and it goes out of its superview’s bounds. So, the issue is present only on Sonoma, if build with Xcode 15.

The difference is visible even inside Interface Builder. Here is a short video of shrinking a superview in IB of Xcode 14, note how the “Two” radio button becomes invisible, as it goes outside of its superview’s bounds:

https://zigz.ag/temp/SubviewBug/InterfaceBuilderXcode14.mov

Here is the video of shrinking the same superview in IB of Xcode 15, the “Two” radio button remains visible regardless of its superview’s bounds:

https://zigz.ag/temp/SubviewBug/InterfaceBuilderXcode15.mov

Is this a bug? Or did I miss something in macOS 14 Sonoma SDK release notes, which would indicate from now on this is expected behaviour (highly unlikely)?

-- Dragan

Answered by milke in 779611022

As someone has notified me in the meanwhile, this is the consequence of the default value of property clipsToBounds of NSView being changed from 'YEStoNO` in Sonoma SDK.

-- Dragan

Accepted Answer

As someone has notified me in the meanwhile, this is the consequence of the default value of property clipsToBounds of NSView being changed from 'YEStoNO` in Sonoma SDK.

-- Dragan

Unhidden subview outside of superview's bounds
 
 
Q