audit tooltip
This commit is contained in:
@@ -876,7 +876,9 @@ impl Render for ButtonDemo {
|
||||
});
|
||||
});
|
||||
if variant == ButtonVariant::Destructive {
|
||||
button = button.tooltip(Tooltip::text("Removes the selected item"));
|
||||
let id = SharedString::from(format!("button-demo-{name}"));
|
||||
button = button
|
||||
.tooltip(Tooltip::anchored("Removes the selected item", id));
|
||||
}
|
||||
button
|
||||
})),
|
||||
@@ -901,7 +903,9 @@ impl Render for ButtonDemo {
|
||||
});
|
||||
});
|
||||
if variant == ButtonVariant::Destructive {
|
||||
button = button.tooltip(Tooltip::text("Removes the selected item"));
|
||||
let id = SharedString::from(format!("button-demo-icon-{name}"));
|
||||
button = button
|
||||
.tooltip(Tooltip::anchored("Removes the selected item", id));
|
||||
}
|
||||
button
|
||||
})),
|
||||
@@ -914,11 +918,12 @@ impl Render for ButtonDemo {
|
||||
.gap_2()
|
||||
.children(variants.map(|(name, variant)| {
|
||||
let view = view.clone();
|
||||
Button::new(SharedString::from(format!("button-demo-icon-only-{name}")))
|
||||
let id = SharedString::from(format!("button-demo-icon-only-{name}"));
|
||||
Button::new(id.clone())
|
||||
.icon(IconRole::Folder)
|
||||
.variant(variant)
|
||||
.accessibility_label("Open the selected file")
|
||||
.tooltip(Tooltip::text("Opens the selected file"))
|
||||
.tooltip(Tooltip::anchored("Opens the selected file", id))
|
||||
.on_click(move |_, _, cx| {
|
||||
view.update(cx, |demo, cx| {
|
||||
demo.clicks += 1;
|
||||
@@ -2800,20 +2805,29 @@ impl Render for TooltipDemo {
|
||||
Button::new("tooltip-demo-destructive")
|
||||
.label("Delete")
|
||||
.variant(ButtonVariant::Destructive)
|
||||
.tooltip(Tooltip::text("Removes the selected item")),
|
||||
.tooltip(Tooltip::anchored(
|
||||
"Removes the selected item",
|
||||
"tooltip-demo-destructive",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
Button::new("tooltip-demo-icon")
|
||||
.label("Open")
|
||||
.icon(IconRole::Folder)
|
||||
.tooltip(Tooltip::text("Opens the selected file")),
|
||||
.tooltip(Tooltip::anchored(
|
||||
"Opens the selected file",
|
||||
"tooltip-demo-icon",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
Button::new("tooltip-demo-icon-only")
|
||||
.icon(IconRole::Folder)
|
||||
.variant(ButtonVariant::Ghost)
|
||||
.accessibility_label("Open the selected file")
|
||||
.tooltip(Tooltip::text("Opens the selected file")),
|
||||
.tooltip(Tooltip::anchored(
|
||||
"Opens the selected file",
|
||||
"tooltip-demo-icon-only",
|
||||
)),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user