Skip to content

Commit

Permalink
rename navigatable to navigable
Browse files Browse the repository at this point in the history
Navigable is generally considered correct and is 
also consistent with other parts of the code base.
  • Loading branch information
jrmoulton committed Oct 25, 2024
1 parent 14cc2a3 commit 63ce589
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions examples/counter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn app_view() -> impl IntoView {
set_counter.update(|value| *value += 1);
}
})
.keyboard_navigatable(),
.keyboard_navigable(),
"Decrement"
.on_click_stop({
move |_| {
Expand All @@ -45,7 +45,7 @@ fn app_view() -> impl IntoView {
.hover(|s| s.background(Color::rgb8(244, 67, 54)))
.active(|s| s.color(Color::WHITE).background(Color::RED))
})
.keyboard_navigatable(),
.keyboard_navigable(),
"Reset to 0"
.on_click_stop(move |_| {
println!("Reset counter pressed"); // will not fire if button is disabled
Expand All @@ -63,7 +63,7 @@ fn app_view() -> impl IntoView {
.hover(|s| s.background(Color::LIGHT_YELLOW))
.active(|s| s.color(Color::WHITE).background(Color::YELLOW_GREEN))
})
.keyboard_navigatable(),
.keyboard_navigable(),
)
.style(|s| {
s.class(LabelClass, |s| {
Expand Down
2 changes: 1 addition & 1 deletion examples/keyboard_handler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn app_view() -> impl IntoView {
.items_center()
.justify_center()
});
view.keyboard_navigatable()
view.keyboard_navigable()
.on_event_stop(EventListener::KeyDown, move |e| {
if let Event::KeyDown(e) = e {
if e.key.logical_key == Key::Character("q".into()) {
Expand Down
2 changes: 1 addition & 1 deletion examples/layout/src/tab_navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn tab_button(
active_tab: ReadSignal<usize>,
) -> impl IntoView {
label(move || this_tab)
.keyboard_navigatable()
.keyboard_navigable()
.on_click_stop(move |_| {
set_active_tab.update(|v: &mut usize| {
*v = tabs
Expand Down
8 changes: 4 additions & 4 deletions examples/themes/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn app_view() -> impl IntoView {
set_theme.update(|theme| *theme = !*theme);
}
})
.keyboard_navigatable(),
.keyboard_navigable(),
stack((
label(move || format!("Value: {}", counter.get())).class(Label),
text("Increment")
Expand All @@ -112,23 +112,23 @@ fn app_view() -> impl IntoView {
set_counter.update(|value| *value += 1);
}
})
.keyboard_navigatable(),
.keyboard_navigable(),
text("Decrement")
.class(Button)
.on_click_stop({
move |_| {
set_counter.update(|value| *value -= 1);
}
})
.keyboard_navigatable(),
.keyboard_navigable(),
text("Reset to 0")
.class(Button)
.on_click_stop(move |_| {
println!("Reset counter pressed"); // will not fire if button is disabled
set_counter.update(|value| *value = 0);
})
.disabled(move || counter.get() == 0)
.keyboard_navigatable(),
.keyboard_navigable(),
))
.class(Frame)
.style(|s| s.items_center()),
Expand Down
2 changes: 1 addition & 1 deletion examples/widget-gallery/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn clipboard_view() -> impl IntoView {
}),
form_item("Copy from input".to_string(), 120.0, move || {
h_stack((
text_input(text1).keyboard_navigatable(),
text_input(text1).keyboard_navigable(),
button("Copy").action(move || {
let _ = Clipboard::set_contents(text1.get());
}),
Expand Down
2 changes: 1 addition & 1 deletion examples/widget-gallery/src/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn dropdown_view() -> impl IntoView {
// view for each item in the list
|item| label(move || item).into_any(),
)
.keyboard_navigatable()
.keyboard_navigable()
}),)
})
}
4 changes: 2 additions & 2 deletions examples/widget-gallery/src/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn text_input_view() -> impl IntoView {
form_item("Simple Input:".to_string(), 120.0, move || {
text_input(text)
.placeholder("Placeholder text")
.keyboard_navigatable()
.keyboard_navigable()
}),
form_item("Styled Input:".to_string(), 120.0, move || {
text_input(text)
Expand All @@ -44,7 +44,7 @@ pub fn text_input_view() -> impl IntoView {
.font_weight(Weight::BOLD)
})
})
.keyboard_navigatable()
.keyboard_navigable()
}),
form_item("Disabled Input:".to_string(), 120.0, move || {
text_input(text).disabled(|| true)
Expand Down
2 changes: 1 addition & 1 deletion examples/widget-gallery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn app_view() -> impl IntoView {
EventPropagation::Continue
}
})
.keyboard_navigatable()
.keyboard_navigable()
.draggable()
.style(move |s| {
s.flex_row()
Expand Down
6 changes: 3 additions & 3 deletions examples/window-scale/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn app_view() -> impl IntoView {
.on_click_stop(move |_| {
set_counter.update(|value| *value += 1);
})
.keyboard_navigatable(),
.keyboard_navigable(),
label(|| "Decrement")
.class(Button)
.on_click_stop(move |_| {
Expand All @@ -34,7 +34,7 @@ fn app_view() -> impl IntoView {
.hover(|s| s.background(Color::rgb8(244, 67, 54)))
.active(|s| s.background(Color::RED))
})
.keyboard_navigatable(),
.keyboard_navigable(),
label(|| "Reset to 0")
.class(Button)
.on_click_stop(move |_| {
Expand All @@ -48,7 +48,7 @@ fn app_view() -> impl IntoView {
.hover(|s| s.background(Color::LIGHT_YELLOW))
.active(|s| s.background(Color::YELLOW_GREEN))
})
.keyboard_navigatable(),
.keyboard_navigable(),
)
}),
stack({
Expand Down
2 changes: 1 addition & 1 deletion src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl ViewId {
}

/// Mark this view as a view that can be navigated to using the keyboard
pub fn keyboard_navigatable(&self) {
pub fn keyboard_navigable(&self) {
self.add_update_message(UpdateMessage::KeyboardNavigable { id: *self });
}

Expand Down
4 changes: 2 additions & 2 deletions src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ fn add_event(
capture: &Rc<Capture>,
) -> impl View {
let capture = capture.clone();
row.keyboard_navigatable()
row.keyboard_navigable()
.on_secondary_click({
let name = name.clone();
move |_| {
Expand Down Expand Up @@ -810,7 +810,7 @@ fn capture_view(
.margin_bottom(21.0)
.margin_right(21.0)
})
.keyboard_navigatable()
.keyboard_navigable()
.on_event_stop(EventListener::KeyUp, {
move |event: &Event| {
if let Event::KeyUp(key) = event {
Expand Down
2 changes: 1 addition & 1 deletion src/views/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Button {
pub fn new(child: impl IntoView) -> Self {
let id = ViewId::new();
id.add_child(Box::new(child.into_view()));
Button { id }.keyboard_navigatable().class(ButtonClass)
Button { id }.keyboard_navigable().class(ButtonClass)
}

pub fn action(self, mut on_press: impl FnMut() + 'static) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/views/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn checkbox_svg(checked: impl SignalGet<bool> + 'static) -> impl IntoView {
svg(CHECKBOX_SVG)
.update_value(svg_str)
.class(CheckboxClass)
.keyboard_navigatable()
.keyboard_navigable()
}

/// The `Checkbox` struct provides various methods to create and manage checkboxes.
Expand Down
4 changes: 2 additions & 2 deletions src/views/decorator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ pub trait Decorators: IntoView<V = Self::DV> + Sized {
}

/// Allows the element to be navigated to with the keyboard. Similar to setting tabindex="0" in html.
fn keyboard_navigatable(self) -> Self::DV {
fn keyboard_navigable(self) -> Self::DV {
let view = self.into_view();
view.id().keyboard_navigatable();
view.id().keyboard_navigable();
view
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<T> Dropdown<T> {
}
})
.style(|s| s.size_full())
.keyboard_navigatable()
.keyboard_navigable()
.on_event_stop(EventListener::PointerDown, move |_| {})
.on_event_stop(EventListener::FocusLost, move |_| {
dropdown_id.update_state(Message::ListFocusLost);
Expand Down
2 changes: 1 addition & 1 deletion src/views/editor/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ pub fn editor_view(
is_active,
inner_node: None,
}
.keyboard_navigatable()
.keyboard_navigable()
.on_event(EventListener::ImePreedit, move |event| {
if !is_active.get_untracked() {
return EventPropagation::Continue;
Expand Down
2 changes: 1 addition & 1 deletion src/views/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ where
child,
onaccept: None,
}
.keyboard_navigatable()
.keyboard_navigable()
.on_event(EventListener::KeyDown, move |e| {
if let Event::KeyDown(key_event) = e {
match key_event.key.logical_key {
Expand Down
12 changes: 6 additions & 6 deletions src/views/radio_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl RadioButton {

value_container(
radio_button_svg(represented_value.clone(), inbound_signal.read_only())
.keyboard_navigatable()
.keyboard_navigable()
.on_click_stop(move |_| {
outbound_signal.set(represented_value.clone());
}),
Expand All @@ -65,7 +65,7 @@ impl RadioButton {
where
T: Eq + PartialEq + Clone + 'static,
{
radio_button_svg(represented_value, actual_value).keyboard_navigatable()
radio_button_svg(represented_value, actual_value).keyboard_navigable()
}

/// Creates a new radio button with a signal that provides and updates its selected state.
Expand All @@ -82,7 +82,7 @@ impl RadioButton {
let cloneable_represented_value = represented_value.clone();

radio_button_svg(cloneable_represented_value.clone(), actual_value)
.keyboard_navigatable()
.keyboard_navigable()
.on_click_stop(move |_| {
actual_value.set(cloneable_represented_value.clone());
})
Expand All @@ -109,7 +109,7 @@ impl RadioButton {
))
.class(LabeledRadioButtonClass)
.style(|s| s.items_center())
.keyboard_navigatable()
.keyboard_navigable()
.on_click_stop(move |_| {
outbound_signal.set(represented_value.clone());
}),
Expand All @@ -135,7 +135,7 @@ impl RadioButton {
))
.class(LabeledRadioButtonClass)
.style(|s| s.items_center())
.keyboard_navigatable()
.keyboard_navigable()
}

/// Creates a new labeled radio button with a signal that provides and updates its selected state.
Expand All @@ -158,7 +158,7 @@ impl RadioButton {
))
.class(LabeledRadioButtonClass)
.style(|s| s.items_center())
.keyboard_navigatable()
.keyboard_navigable()
.on_click_stop(move |_| {
actual_value.set(cloneable_represented_value.clone());
})
Expand Down
2 changes: 1 addition & 1 deletion src/views/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ impl Slider {
style: Default::default(),
}
.class(SliderClass)
.keyboard_navigatable()
.keyboard_navigable()
}

pub fn new_get(percent: impl SignalGet<f32> + 'static) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/views/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn text_input(buffer: RwSignal<String>) -> TextInput {
is_focused: false,
last_cursor_action_on: Instant::now(),
}
.keyboard_navigatable()
.keyboard_navigable()
.on_event_stop(EventListener::FocusGained, move |_| {
is_focused.set(true);
})
Expand Down
2 changes: 1 addition & 1 deletion src/views/toggle_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl ToggleButton {
style: Default::default(),
}
.class(ToggleButtonClass)
.keyboard_navigatable()
.keyboard_navigable()
}

pub fn new_rw(state: impl SignalGet<bool> + SignalUpdate<bool> + Copy + 'static) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/views/virtual_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ where
child,
}
.class(ListClass)
.keyboard_navigatable()
.keyboard_navigable()
.on_event(EventListener::KeyDown, move |e| {
if let Event::KeyDown(key_event) = e {
match key_event.key.logical_key {
Expand Down

0 comments on commit 63ce589

Please sign in to comment.