use std::rc::Rc;
use gpui::{
AnyElement, App, ClickEvent, Div, ElementId, FocusHandle, InteractiveElement, Interactivity,
IntoElement, MouseButton, ParentElement, Refineable as _, RenderOnce, Role, SharedString,
Stateful, StatefulInteractiveElement, StyleRefinement, Styled, Window, div,
prelude::FluentBuilder as _, relative,
};
use smallvec::SmallVec;
use crate::{
RoleOverride, Selectable, StateStyle, StyledExt as _, TestSupportExt as _,
a11y_disabled::A11yDisabledExt as _,
};
type ClickHandler = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
#[derive(IntoElement)]
pub struct Button {
id: ElementId,
base: crate::ObservedElement<Stateful<Div>>,
style: StyleRefinement,
semantic_styles: ButtonStyles,
selected: bool,
current: bool,
disabled: bool,
focus_when_disabled: bool,
pointer_styles: PointerStyles,
children: SmallVec<[AnyElement; 2]>,
on_click: Option<ClickHandler>,
accessibility_label: Option<SharedString>,
role: RoleOverride,
provided_focus_handle: Option<FocusHandle>,
tab_index: isize,
tab_stop: bool,
focusable: bool,
}
impl Button {
pub fn new(id: impl Into<ElementId>) -> Self {
let id = id.into();
Self {
base: div().id(id.clone()).test_support(),
id,
style: StyleRefinement::default(),
semantic_styles: ButtonStyles::default(),
selected: false,
current: false,
disabled: false,
focus_when_disabled: false,
pointer_styles: PointerStyles::default(),
children: SmallVec::new(),
on_click: None,
accessibility_label: None,
role: RoleOverride::Implicit,
provided_focus_handle: None,
tab_index: 0,
tab_stop: true,
focusable: true,
}
}
pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = disabled;
self
}
pub(crate) fn focus_when_disabled(mut self, focusable: bool) -> Self {
self.focus_when_disabled = focusable;
self
}
pub fn selected(mut self, selected: bool) -> Self {
self.selected = selected;
self
}
pub fn current(mut self, current: bool) -> Self {
self.current = current;
self
}
pub fn styles(mut self, build: impl FnOnce(ButtonStyles) -> ButtonStyles) -> Self {
self.semantic_styles = build(self.semantic_styles);
self
}
pub fn accessibility_label(mut self, label: impl Into<SharedString>) -> Self {
self.accessibility_label = Some(label.into());
self
}
pub fn role(mut self, role: impl Into<RoleOverride>) -> Self {
self.role = role.into();
self
}
pub fn track_focus(mut self, focus_handle: &FocusHandle) -> Self {
self.provided_focus_handle = Some(focus_handle.clone());
self
}
pub fn on_click(
mut self,
handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> Self {
self.on_click = Some(Rc::new(handler));
self
}
pub fn tab_index(mut self, tab_index: isize) -> Self {
self.tab_index = tab_index;
self
}
pub fn tab_stop(mut self, tab_stop: bool) -> Self {
self.tab_stop = tab_stop;
self
}
pub fn focusable(mut self, focusable: bool) -> Self {
self.focusable = focusable;
self
}
fn focus_handle(&self, window: &mut Window, cx: &mut App) -> FocusHandle {
self.provided_focus_handle.clone().unwrap_or_else(|| {
window
.use_keyed_state(self.id.clone(), cx, |_, cx| cx.focus_handle())
.read(cx)
.clone()
})
}
fn resolved_style(&self) -> StyleRefinement {
crate::state_style::resolve_style(
&self.style,
[
self.selected.then_some(&self.semantic_styles.selected),
self.disabled.then_some(&self.semantic_styles.disabled),
]
.into_iter()
.flatten(),
)
}
}
impl Selectable for Button {
fn selected(self, selected: bool) -> Self {
Button::selected(self, selected)
}
fn is_selected(&self) -> bool {
self.selected
}
}
#[derive(Default)]
pub struct ButtonStyles {
selected: StyleRefinement,
disabled: StyleRefinement,
}
impl ButtonStyles {
pub fn selected(mut self, build: impl FnOnce(StateStyle) -> StateStyle) -> Self {
self.selected
.refine(&build(StateStyle::default()).into_refinement());
self
}
pub fn disabled(mut self, build: impl FnOnce(StateStyle) -> StateStyle) -> Self {
self.disabled
.refine(&build(StateStyle::default()).into_refinement());
self
}
}
impl Styled for Button {
fn style(&mut self) -> &mut StyleRefinement {
&mut self.style
}
}
impl ParentElement for Button {
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>) {
self.children.extend(elements);
}
}
#[derive(Default)]
struct PointerStyles {
hover: Option<StyleRefinement>,
active: Option<StyleRefinement>,
group_hover: Option<(SharedString, StyleRefinement)>,
group_active: Option<(SharedString, StyleRefinement)>,
}
impl InteractiveElement for Button {
fn interactivity(&mut self) -> &mut Interactivity {
self.base.interactivity()
}
fn hover(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self {
self.pointer_styles.hover = Some(f(StyleRefinement::default()));
self
}
fn group_hover(
mut self,
group_name: impl Into<SharedString>,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self {
self.pointer_styles.group_hover = Some((group_name.into(), f(StyleRefinement::default())));
self
}
}
impl StatefulInteractiveElement for Button {
fn active(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self {
self.pointer_styles.active = Some(f(StyleRefinement::default()));
self
}
fn group_active(
mut self,
group_name: impl Into<SharedString>,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self {
self.pointer_styles.group_active = Some((group_name.into(), f(StyleRefinement::default())));
self
}
}
macro_rules! forward_hover_styles {
($field:ident) => {
fn hover(mut self, f: impl FnOnce(gpui::StyleRefinement) -> gpui::StyleRefinement) -> Self {
self.$field = gpui::InteractiveElement::hover(self.$field, f);
self
}
fn group_hover(
mut self,
group_name: impl Into<gpui::SharedString>,
f: impl FnOnce(gpui::StyleRefinement) -> gpui::StyleRefinement,
) -> Self {
self.$field = gpui::InteractiveElement::group_hover(self.$field, group_name, f);
self
}
};
}
macro_rules! forward_active_styles {
($field:ident) => {
fn active(
mut self,
f: impl FnOnce(gpui::StyleRefinement) -> gpui::StyleRefinement,
) -> Self {
self.$field = gpui::StatefulInteractiveElement::active(self.$field, f);
self
}
fn group_active(
mut self,
group_name: impl Into<gpui::SharedString>,
f: impl FnOnce(gpui::StyleRefinement) -> gpui::StyleRefinement,
) -> Self {
self.$field =
gpui::StatefulInteractiveElement::group_active(self.$field, group_name, f);
self
}
};
}
pub(crate) use {forward_active_styles, forward_hover_styles};
impl RenderOnce for Button {
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
let focus_handle = self.focus_handle(window, cx);
let disabled = self.disabled;
let style = self.resolved_style();
let on_click = self.on_click;
let pointer_styles = if disabled {
PointerStyles::default()
} else {
self.pointer_styles
};
let base = self
.base
.flex()
.items_center()
.justify_center()
.line_height(relative(1.))
.when_some(self.role.resolve(|| Role::Button), |this, role| {
this.role(role)
})
.when_some(self.accessibility_label, |this, label| {
this.aria_label(label)
})
.when(
self.focusable
&& (!disabled || self.focus_when_disabled || focus_handle.is_focused(window)),
|this| {
this.track_focus(
&focus_handle
.clone()
.tab_index(self.tab_index)
.tab_stop(self.tab_stop && (!disabled || self.focus_when_disabled)),
)
},
)
.when(self.focusable, |this| {
this.on_any_mouse_down(|event, window, _| {
if event.button != MouseButton::Left {
window.prevent_default();
}
})
})
.when(disabled, |this| {
this.on_mouse_down(MouseButton::Left, |_, _, cx| {
cx.stop_propagation();
})
})
.when_some(pointer_styles.hover, |this, style| this.hover(|_| style))
.when_some(pointer_styles.active, |this, style| this.active(|_| style))
.when_some(pointer_styles.group_hover, |this, (group, style)| {
this.group_hover(group, |_| style)
})
.when_some(pointer_styles.group_active, |this, (group, style)| {
this.group_active(group, |_| style)
})
.when_some(
(!disabled).then_some(on_click).flatten(),
|this, on_click| {
this.on_click(move |event, window, cx| {
on_click(event, window, cx);
})
},
)
.children(self.children)
.when(self.focusable, |this| {
crate::ElementExt::on_prepaint(this, move |bounds, window, _| {
window.with_global_id("button-focus-reveal".into(), |id, window| {
window.with_element_state(id, |was_focused: Option<bool>, window| {
let focused = focus_handle.is_focused(window);
if focused && was_focused != Some(true) {
window.request_autoscroll(bounds);
}
((), focused)
});
});
})
})
.refine_style(&style)
.a11y_disabled(disabled);
crate::a11y_current::current_page(base, self.current)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::ElementExt as _;
use std::{
cell::Cell,
rc::Rc,
sync::{Arc, Mutex},
};
use gpui::{
AppContext as _, ClickEvent, Context, Element as _, KeyDownEvent, KeyUpEvent, Keystroke,
Modifiers, Render, TestAppContext, VisualTestContext, accesskit, canvas, point, px,
};
struct ButtonHarness {
disabled: bool,
button_clicks: Rc<Cell<usize>>,
parent_clicks: Rc<Cell<usize>>,
keyboard_events: Rc<Cell<usize>>,
}
impl Render for ButtonHarness {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let button_clicks = self.button_clicks.clone();
let keyboard_events = self.keyboard_events.clone();
let parent_clicks = self.parent_clicks.clone();
div()
.id("button-parent")
.tab_group()
.size(px(100.))
.on_click(move |_, _, _| parent_clicks.set(parent_clicks.get() + 1))
.child(
Button::new("button")
.disabled(self.disabled)
.size_full()
.on_click(move |event, _, _| {
button_clicks.set(button_clicks.get() + 1);
if matches!(event, ClickEvent::Keyboard(_)) {
keyboard_events.set(keyboard_events.get() + 1);
}
}),
)
}
}
fn harness(
cx: &mut TestAppContext,
disabled: bool,
) -> (
&mut VisualTestContext,
Rc<Cell<usize>>,
Rc<Cell<usize>>,
Rc<Cell<usize>>,
) {
let button_clicks = Rc::new(Cell::new(0));
let parent_clicks = Rc::new(Cell::new(0));
let keyboard_events = Rc::new(Cell::new(0));
let (_, cx) = cx.add_window_view({
let button_clicks = button_clicks.clone();
let parent_clicks = parent_clicks.clone();
let keyboard_events = keyboard_events.clone();
move |_, _| ButtonHarness {
disabled,
button_clicks,
parent_clicks,
keyboard_events,
}
});
cx.update(|window, cx| {
window.draw(cx).clear(cx);
});
(cx, button_clicks, parent_clicks, keyboard_events)
}
#[gpui::test]
fn pointer_enter_and_space_use_one_native_click_each(cx: &mut TestAppContext) {
let (cx, button_clicks, _, keyboard_events) = harness(cx, false);
cx.simulate_click(point(px(10.), px(10.)), Modifiers::default());
assert_eq!(button_clicks.get(), 1);
assert_eq!(keyboard_events.get(), 0);
button_clicks.set(0);
cx.update(|window, cx| {
assert!(window.focused(cx).is_some());
window.draw(cx).clear(cx);
});
for key in ["enter", "space"] {
let keystroke =
cx.update(|_, cx| Keystroke::parse_with_os(key, cx.platform_info().os).unwrap());
cx.simulate_event(KeyDownEvent {
keystroke: keystroke.clone(),
is_held: false,
prefer_character_input: false,
});
cx.simulate_event(KeyUpEvent { keystroke });
}
assert_eq!(button_clicks.get(), 2);
assert_eq!(keyboard_events.get(), 2);
}
#[gpui::test]
fn disabled_button_is_inert_and_blocks_parent_activation(cx: &mut TestAppContext) {
let (cx, button_clicks, parent_clicks, _) = harness(cx, true);
cx.simulate_click(point(px(10.), px(10.)), Modifiers::default());
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_keystrokes("enter space");
assert_eq!(button_clicks.get(), 0);
assert_eq!(parent_clicks.get(), 0);
}
struct DisableDuringFocus {
handles: [FocusHandle; 3],
disabled: bool,
activations: usize,
scroll: gpui::ScrollHandle,
}
impl Render for DisableDuringFocus {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div().size_full().tab_group().child(
crate::ScrollArea::new("button-scroll", &self.scroll)
.w(px(180.))
.h(px(60.))
.content_styles(|style| style.flex().flex_col().gap(px(40.)))
.child(
Button::new("before")
.track_focus(&self.handles[0])
.h(px(40.))
.flex_shrink_0()
.child("Before"),
)
.child(
Button::new("disable-self")
.track_focus(&self.handles[1])
.h(px(40.))
.flex_shrink_0()
.disabled(self.disabled)
.child("Disable self")
.on_click(cx.listener(|this, _, _, cx| {
this.disabled = true;
this.activations += 1;
cx.notify();
})),
)
.child(
Button::new("after")
.track_focus(&self.handles[2])
.h(px(40.))
.flex_shrink_0()
.child("After"),
),
)
}
}
fn press_transition_key(cx: &mut VisualTestContext, key: &str) {
let keystroke =
cx.update(|_, cx| Keystroke::parse_with_os(key, cx.platform_info().os).unwrap());
cx.simulate_event(KeyDownEvent {
keystroke: keystroke.clone(),
is_held: false,
prefer_character_input: false,
});
cx.simulate_event(KeyUpEvent { keystroke });
cx.update(|window, cx| window.draw(cx).clear(cx));
}
#[gpui::test]
fn disabling_focused_button_preserves_bidirectional_traversal(cx: &mut TestAppContext) {
cx.update(crate::init);
for (key, expected, back, opposite) in
[("tab", 2, "shift-tab", 0), ("shift-tab", 0, "tab", 2)]
{
let handles = cx.update(|cx| std::array::from_fn(|_| cx.focus_handle()));
let scroll = gpui::ScrollHandle::new();
let controls = cx.new(|_| DisableDuringFocus {
handles: handles.clone(),
disabled: false,
activations: 0,
scroll: scroll.clone(),
});
let (_, cx) =
cx.add_window_view(|window, cx| crate::Root::new(controls.clone(), window, cx));
cx.update(|window, cx| {
window.activate_window();
window.draw(cx).clear(cx);
handles[0].focus(window, cx);
window.draw(cx).clear(cx);
});
press_transition_key(cx, "tab");
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert_eq!(window.focused(cx).as_ref(), Some(&handles[1]));
});
assert!(
scroll.offset().y < px(0.),
"new focus reveals the hidden button"
);
scroll.set_offset(point(px(0.), px(0.)));
cx.update(|window, cx| {
window.draw(cx).clear(cx);
window.draw(cx).clear(cx);
});
assert_eq!(
scroll.offset().y,
px(0.),
"redrawing retained focus preserves manual scroll position"
);
press_transition_key(cx, "space");
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert!(controls.read(cx).disabled);
assert_eq!(controls.read(cx).activations, 1);
});
press_transition_key(cx, "enter");
press_transition_key(cx, "space");
cx.update(|_, cx| {
assert_eq!(controls.read(cx).activations, 1, "disabled stays inert");
});
press_transition_key(cx, key);
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert_eq!(window.focused(cx).as_ref(), Some(&handles[expected]));
});
press_transition_key(cx, back);
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert_eq!(window.focused(cx).as_ref(), Some(&handles[opposite]));
});
controls.update(cx, |this, cx| {
this.disabled = false;
cx.notify();
});
cx.update(|window, cx| window.draw(cx).clear(cx));
press_transition_key(cx, key);
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert_eq!(window.focused(cx).as_ref(), Some(&handles[1]));
});
}
}
#[gpui::test]
fn disabled_button_and_wrappers_ignore_hover_and_active_styles(cx: &mut TestAppContext) {
struct PointerProbe {
disabled: bool,
toggle: bool,
text_color: Rc<Cell<Option<gpui::Hsla>>>,
}
impl Render for PointerProbe {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let text_color = self.text_color.clone();
let probe = canvas(
|_, _, _| {},
move |_, _, window, _| text_color.set(Some(window.text_style().color)),
)
.size_full();
if self.toggle {
crate::Toggle::new("pointer-probe")
.size(px(40.))
.text_color(gpui::red())
.hover(|style| style.text_color(gpui::green()))
.active(|style| style.text_color(gpui::blue()))
.disabled(self.disabled)
.child(probe)
.into_any_element()
} else {
Button::new("pointer-probe")
.size(px(40.))
.text_color(gpui::red())
.hover(|style| style.text_color(gpui::green()))
.active(|style| style.text_color(gpui::blue()))
.disabled(self.disabled)
.child(probe)
.into_any_element()
}
}
}
for toggle in [false, true] {
let text_color = Rc::new(Cell::new(None));
let (view, cx) = cx.add_window_view({
let text_color = text_color.clone();
move |_, _| PointerProbe {
disabled: true,
toggle,
text_color,
}
});
let redraw =
|cx: &mut VisualTestContext| cx.update(|window, cx| window.draw(cx).clear(cx));
let position = point(px(10.), px(10.));
redraw(cx);
cx.simulate_mouse_move(position, None, Modifiers::default());
redraw(cx);
assert_eq!(
text_color.get(),
Some(gpui::red()),
"disabled ignores hover"
);
cx.simulate_mouse_down(position, MouseButton::Left, Modifiers::default());
redraw(cx);
assert_eq!(
text_color.get(),
Some(gpui::red()),
"disabled ignores active"
);
cx.simulate_mouse_up(position, MouseButton::Left, Modifiers::default());
view.update(cx, |this, cx| {
this.disabled = false;
cx.notify();
});
redraw(cx);
assert_eq!(text_color.get(), Some(gpui::green()), "enabled shows hover");
cx.simulate_mouse_down(position, MouseButton::Left, Modifiers::default());
redraw(cx);
assert_eq!(text_color.get(), Some(gpui::blue()), "enabled shows active");
cx.simulate_mouse_up(position, MouseButton::Left, Modifiers::default());
}
}
#[gpui::test]
fn secondary_and_middle_presses_do_not_focus_but_reach_the_parent(cx: &mut TestAppContext) {
struct Harness {
focus_handle: FocusHandle,
parent_presses: Rc<Cell<usize>>,
}
impl Render for Harness {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let parent_presses = self.parent_presses.clone();
div()
.size(px(100.))
.on_any_mouse_down(move |_, _, _| parent_presses.set(parent_presses.get() + 1))
.child(
Button::new("non-primary")
.size_full()
.track_focus(&self.focus_handle),
)
}
}
let parent_presses = Rc::new(Cell::new(0));
let (view, cx) = cx.add_window_view({
let parent_presses = parent_presses.clone();
move |_, cx| Harness {
focus_handle: cx.focus_handle(),
parent_presses,
}
});
let focus_handle = cx.update(|_, cx| view.read(cx).focus_handle.clone());
cx.update(|window, cx| window.draw(cx).clear(cx));
let position = point(px(10.), px(10.));
for button in [MouseButton::Right, MouseButton::Middle, MouseButton::Left] {
cx.simulate_mouse_down(position, button, Modifiers::default());
cx.simulate_mouse_up(position, button, Modifiers::default());
cx.update(|window, cx| {
window.draw(cx).clear(cx);
assert_eq!(
focus_handle.is_focused(window),
button == MouseButton::Left,
"only a primary press focuses the button ({button:?})"
);
});
}
assert_eq!(parent_presses.get(), 3);
}
#[gpui::test]
fn fixed_height_button_centers_ordinary_child_geometry(cx: &mut TestAppContext) {
type Captured = Arc<
Mutex<(
Option<gpui::Bounds<gpui::Pixels>>,
Option<gpui::Bounds<gpui::Pixels>>,
)>,
>;
struct AlignmentProbe {
captured: Captured,
}
impl Render for AlignmentProbe {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let root_capture = self.captured.clone();
let child_capture = self.captured.clone();
Button::new("alignment-button")
.w(px(120.))
.h(px(40.))
.child(
div()
.w(px(48.))
.h(px(12.))
.on_prepaint(move |bounds, _, _| {
child_capture.lock().unwrap().1 = Some(bounds);
}),
)
.on_prepaint(move |bounds, _, _| {
root_capture.lock().unwrap().0 = Some(bounds);
})
}
}
let captured = Arc::new(Mutex::new((None, None)));
let (_, context) = cx.add_window_view({
let captured = captured.clone();
move |_, _| AlignmentProbe { captured }
});
context.update(|window, cx| window.draw(cx).clear(cx));
let (root, child) = *captured.lock().unwrap();
let root = root.expect("button bounds");
let child = child.expect("child bounds");
assert_eq!(child.center(), root.center());
}
#[test]
fn selected_disabled_and_instance_styles_follow_the_shared_priority() {
let selected_color = gpui::hsla(0.6, 0.7, 0.5, 1.0);
let disabled_color = gpui::hsla(0.1, 0.2, 0.3, 0.5);
let button = |selected, disabled| {
Button::new("button")
.selected(selected)
.disabled(disabled)
.styles(|styles| {
styles
.selected(|style| style.bg(selected_color))
.disabled(|style| style.bg(disabled_color))
})
};
assert_eq!(button(false, false).resolved_style().background, None);
assert_eq!(
button(true, false).resolved_style().background,
Some(selected_color.into())
);
assert_eq!(
button(true, true).resolved_style().background,
Some(disabled_color.into())
);
assert_eq!(
button(true, true)
.bg(selected_color)
.resolved_style()
.background,
Some(disabled_color.into())
);
}
#[gpui::test]
fn accessibility_role_label_and_disabled_action_surface(cx: &mut TestAppContext) {
type Captured = Arc<Mutex<Vec<(bool, bool, accesskit::Node)>>>;
struct A11yProbe {
captured: Captured,
}
impl Render for A11yProbe {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let captured = self.captured.clone();
canvas(
move |_, window, cx| {
let mut nodes = captured.lock().unwrap();
nodes.clear();
for (index, (disabled, current)) in
[(false, false), (false, true), (true, false), (true, true)]
.into_iter()
.enumerate()
{
let element = Button::new(("button", index))
.accessibility_label("Settings")
.selected(true)
.current(current)
.disabled(disabled)
.on_click(|_, _, _| {})
.render(window, cx)
.into_element();
let mut node = accesskit::Node::new(element.a11y_role().unwrap());
element.write_a11y_info(&mut node);
nodes.push((disabled, current, node));
}
},
|_, _, _, _| {},
)
}
}
let captured: Captured = Arc::default();
let result = captured.clone();
let (_, cx) = cx.add_window_view(move |_, _| A11yProbe { captured });
cx.update(|window, cx| {
window.draw(cx).clear(cx);
});
let nodes = result.lock().unwrap();
assert_eq!(nodes.len(), 4);
for (disabled, current, node) in nodes.iter() {
assert_eq!(node.role(), Role::Button);
assert_eq!(node.label(), Some("Settings"));
assert_eq!(node.supports_action(accesskit::Action::Click), !disabled);
assert_eq!(node.is_disabled(), *disabled);
assert_eq!(
node.aria_current(),
current.then_some(accesskit::AriaCurrent::Page)
);
assert_eq!(node.is_selected(), None);
}
}
}