diff --git a/src/elements/paginator.rs b/src/elements/paginator.rs index 0a3b4cf..c07d46c 100644 --- a/src/elements/paginator.rs +++ b/src/elements/paginator.rs @@ -75,6 +75,10 @@ impl Element for Paginator { } } + fn is_ghost(&mut self) -> bool { + true + } + fn draw_child(&mut self, element: &Arc) { self.children.push(element.clone()); element.inject(|w| w.component(NoRenderRoot)); diff --git a/src/extensions/focus.rs b/src/extensions/focus.rs index ea3e66f..22d8806 100644 --- a/src/extensions/focus.rs +++ b/src/extensions/focus.rs @@ -118,7 +118,7 @@ impl Extension for RelativeFocusExtension { for (i, w) in ctx.get_widgets().iter().enumerate() { if let Some(AlwaysFocused) = w.get() { w.set_focused(true); - } else { + } else if !w.is_ghost() { w.set_focused(i == self.cursor); } } diff --git a/src/widget.rs b/src/widget.rs index 8800ce4..ed8e802 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -161,12 +161,8 @@ impl Widget { pub fn set_focused(&self, f: bool) { match self { - Self::Dynamic(w) => { - *w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost() - } - Self::Static(w) => { - *w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost() - } + Self::Dynamic(w) => *w.focused.lock().unwrap() = f, + Self::Static(w) => *w.focused.lock().unwrap() = f, } }