I have a UIBarButtonItem created with init(customView:). The custom view draws some content outside its own bounds (clipsToBounds = false).
On iOS 26, that content is clipped to the item's Liquid Glass capsule all the time, both at rest and while the item is pressed.
On iOS 27, the clipping is inconsistent. At rest, the content outside the custom view's bounds is fully visible. While I press the item, it gets clipped to the shape of the Liquid Glass bubble. When I let go, it's fully visible again. So the item's content changes shape during a touch.
- iOS 26.2, at rest: clipped to the capsule
- iOS 26.2, while pressed: clipped to the capsule
- iOS 27, at rest: not clipped, the overflowing content is visible
- iOS 27, while pressed: clipped to the bubble
Reproduced on the iPhone Duo simulator (iOS 27.1) and an iPhone 18 Pro (iOS 27). On an iPhone 17 Pro simulator with iOS 26.2 the behavior is consistent.
Filed as FB25001846.
Steps:
- Put the view controller below in a UINavigationController and run it on iOS 27.
- Look at the right bar button item at rest: the yellow area is visible around the green button.
- Press and hold the button: the yellow area is clipped to the rounded bubble.
- Run the same code on iOS 26: the yellow area is never visible.
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = "Clipping"
view.backgroundColor = .systemBackground
// A button used as the bar button item's custom view.
let button = UIButton(type: .custom)
button.backgroundColor = .systemGreen
button.setTitle("Press me", for: .normal)
button.setTitleColor(.white, for: .normal)
button.addAction(UIAction { _ in print("Pressed") }, for: .touchUpInside)
button.sizeToFit()
let size = button.bounds.size
// The custom view is exactly as big as the button, but draws a yellow background
// that extends 12pt outside its bounds on every side.
let customView = UIView()
customView.clipsToBounds = false
customView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
customView.widthAnchor.constraint(equalToConstant: size.width),
customView.heightAnchor.constraint(equalToConstant: size.height),
])
let overflow = UIView(frame: CGRect(origin: .zero, size: size).insetBy(dx: -12, dy: -12))
overflow.backgroundColor = .systemYellow
customView.addSubview(overflow)
customView.addSubview(button)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: customView)
}
}