Onboarding · Flows and highlights: focus that holds as the flow turns, a tip that closes
navigation::Wizard keeps one focus handle for Next and Finish, so a second press on the step before last finishes; Back that reaches the first step, and a finished step picked by key, hand focus to Next. Popover::with_opener hands its content a close that gives focus back: Got it closes the hotspot's tip before the owner hides it, and the event details close before Edit and Delete run, so focus never lands on a panel that left the tree. The wizard's count and the setup checklist's tally name their selectors after their words, and the bar takes the count's own value.
This commit is contained in:
1 parent
eea99b8e41
commit
1879f6f08b
15 files changed
+180
-54
No files matched your search
@@ -14,7 +14,7 @@ use super::{
|
||||
use crate::{
|
||||
buttons::{Button, ButtonVariant},
|
||||
data_display::color_mark,
|
||||
forms::OnValue,
|
||||
forms::{OnValue, Run},
|
||||
overlays::Popover,
|
||||
primitives::{Icon, IconName},
|
||||
theme::{ActiveTheme, ControlSize, IconSize, TextSize},
|
||||
@@ -107,17 +107,18 @@ impl RenderOnce for EventPopover {
|
||||
.unwrap_or_else(|| format::system_zone("event popover"));
|
||||
let (event, chip_zone) = (self.event.clone(), zone.clone());
|
||||
let (id, chip_id) = (self.id.clone(), (self.id.clone(), "chip"));
|
||||
let details = move |_: &mut Window, cx: &mut App| {
|
||||
let details = move |close: Run, _: &mut Window, cx: &mut App| {
|
||||
let theme = cx.theme();
|
||||
let key = self.event.key.clone();
|
||||
let action = |label: &'static str, variant, handler: Option<OnValue>| {
|
||||
handler.map(|handler| {
|
||||
let key = key.clone();
|
||||
let (key, close) = (key.clone(), close.clone());
|
||||
Button::new((self.id.clone(), label), label)
|
||||
.variant(variant)
|
||||
.size(ControlSize::Sm)
|
||||
.on_click(move |_, window, cx| {
|
||||
log::info!("event popover: {label} {key}");
|
||||
close(window, cx);
|
||||
handler(&key, window, cx)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -90,6 +90,7 @@ fn popover(_: &Planning, owner: Entity<Planning>) -> gpui::AnyElement {
|
||||
fn a_chip_opens_its_details_and_edit_names_it(cx: &mut TestAppContext) {
|
||||
let (host, cx) = planning(popover, cx);
|
||||
tab_to(1, cx);
|
||||
let chip = cx.update(|window, cx| window.focused(cx));
|
||||
press("space", cx);
|
||||
assert!(
|
||||
cx.debug_bounds("event-popover review").is_some(),
|
||||
@@ -105,4 +106,9 @@ fn a_chip_opens_its_details_and_edit_names_it(cx: &mut TestAppContext) {
|
||||
["edit review"],
|
||||
"Tab reaches Delete, then Edit"
|
||||
);
|
||||
let focused = cx.update(|window, cx| window.focused(cx));
|
||||
assert_eq!(
|
||||
focused, chip,
|
||||
"Edit closes the details and hands focus back to the chip"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user