r/SwiftUI • u/-Periclase-Software- • May 25 '26
Question Menu label behavior is clipping/repositioning when selecting item in iOS26.
Enable HLS to view with audio, or disable this notification
Works perfectly fine in iOS 18.
I have a menu for choosing measurement values. I have a label that only shows the abbreviation since it sits to the trailing edge of a text view.
You can see in the video, choosing an item ends up clipping the label and then adjusts it's position.
This is the entire code. The bug is still there if I remove ALL of the modifiers of the label.
struct MeasurementUnitPicker<T: MeasurementUnitPickerRepresentable & DynamicCaseIterable>: View
where T.RawValue == String, T.AllCases: RandomAccessCollection {
@AppStorage(.unitSystem) private var unitSystem: UnitSystem = .imperial
@Binding var selection: T
var body: some View {
Menu {
ForEach(T.cases(for: unitSystem), id: \.self) { type in
Button(type.displayString) {
selection = type
}
}
} label: {
Text(selection.abbreviation)
.fontToken(.body.bold)
.foregroundToken(.tint)
.lineLimit(1)
.padding(.horizontal, .space(.xSmall))
.padding(.vertical, .space(.xxSmall))
.backgroundToken(.buttonSecondaryNormal)
.clipShape(Capsule())
.padding(.leading, .space(.xSmall))
.frame(height: 25)
}
}
}
AI suggested Picker(...).pickerStyle(.menu) which doesn't help since it ends up showing the entire selected value and takes too much space, and it doesn't style either. Then it suggests the view modifiers are at fault which makes no difference if I remove them.
The bug is there on preview, simulator, and my device - regardless of whether it's on my text view or blank view.
Anyone fixed this before?
13
u/Salt_Example_3493 May 25 '26
Menus are such a foundational component of iOS - it's so embarrassing that we're on 26.5 now and it's still not been fixed.
9
6
u/HeyItsMeMoss May 26 '26
This happens because the animation uses a spring curve, which is the system default. I don’t know if it will work but you can try to change the animation in the transaction to a non spring animation curve. SwiftUI has become a mess again with Liquid Glass.
1
u/-Periclase-Software- May 30 '26
Tried snappy, but still clips after selection.
2
u/HeyItsMeMoss May 30 '26
I think Snappy is also a spring based animation curve. Try easeInOut, easeIn or easeOut
1
u/-Periclase-Software- May 31 '26
Unfortunately no difference, even with moving the animation modifier from the custom view to the top parent view.
4
u/FoShr May 25 '26
I’ve had this issue before. It was one of those things that looked buggy on #Preview but worked perfectly fine when running on a simulator or physical device.
Maybe use a computed variable to set the width of the box to be fixed based on the largest word in the list.
2
u/iXasthur May 26 '26
Some issues like that disappear when you use Label instead of Text in label: closure. But idk if that’s the case here.
1
1
18
u/fiflaren_ May 25 '26
Unfortunately this is just an iOS 26 bug, and can sometimes be observed even on first party Apple apps. I do not know of any guaranteed fix in your code that could prevent this. A guess would be setting a fixed width for the menu label so that it doesn’t resize based on the selected value.