13.9 C
Canberra
Friday, January 23, 2026

Textual content isn’t seen when the button is in disabled state


I am encountering a bizarre habits on iOS 26. I’ve a easy Liquid Glass button on a view.

struct ContentView: View {
    @State non-public var isSheetVisible: Bool = false
    @State non-public var textual content: String = ""
    
    
    var physique: some View {
        VStack {
            Button {
                isSheetVisible.toggle()
            } label: {
                Textual content("Present Sheet")
                    .font(.system(measurement: 20))
                    .fontWeight(.semibold)
            }
            .buttonStyle(.glassProminent)
            .controlSize(.giant)
            .buttonSizing(.versatile)
            .tint(.pink)
            .body(width: 340)
            .disabled(textual content.isEmpty)
        }
        .padding()
        .sheet(isPresented: $isSheetVisible) {
            OverlaySheet()
        }
    }
}

This works fantastic. And if I disable the button like this .disabled(textual content.isEmpty), the opacity of the textual content on the button is lowered a bit however nonetheless stays clearly seen.

Textual content isn’t seen when the button is in disabled state

Subsequent, I need to present a sheet over this view and I’ve an analogous button in that sheet as properly.

struct OverlaySheet: View {
    @Surroundings(.dismiss) non-public var dismiss
    @State non-public var textual content: String = ""
    
    
    var physique: some View {
        VStack {
            Button {
                dismiss()
            } label: {
                Textual content("Dismiss")
                    .font(.system(measurement: 20))
                    .fontWeight(.semibold)
            }
            .buttonStyle(.glassProminent)
            .controlSize(.giant)
            .buttonSizing(.versatile)
            .tint(.pink)
            .body(width: 340)
            .disabled(textual content.isEmpty)
        }
        .padding()
        .presentationDetents([.fraction(0.5)])
    }
}

That is the place it will get bizarre. When the button within the sheet isn’t disabled, the button textual content seems. But when I disable the button just like what I did earlier than, the textual content barely seen.

Screenshots showing the button is normal and disabled state

Any thought what that is taking place?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles