Skip to content

Documentation error in Button::selectable() #7777

@MetaflameDragon

Description

@MetaflameDragon

This is a simple error in the documentation for Button::selectable().

The documentation states that the code is equivalent to:

let selected = true;
ui.add(Button::new("toggle me").selected(selected).frame_when_inactive(!selected).frame(true));

However, the source code itself refutes this:

pub fn selectable(selected: bool, atoms: impl IntoAtoms<'a>) -> Self {
    Self::new(atoms)
        .selected(selected)
        .frame_when_inactive(selected) // <- not negated!
        .frame(true)
}

It's a super minor thing, but it just really surprised me when I first tried writing out the equivalent code in full, and the selectable buttons looked unexpectedly wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions