Fix slider focus. (#549)

This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/547

From discussion:
https://github.com/ArthurSonzogni/FTXUI/discussions/546
This commit is contained in:
Arthur Sonzogni
2023-01-07 18:13:59 +01:00
committed by GitHub
parent 5410329ac6
commit 90dfceefcb
2 changed files with 56 additions and 1 deletions

View File

@@ -227,6 +227,7 @@ class SliderWithLabel : public ComponentBase {
}
Element Render() override {
auto focus_management = Focused() ? focus : Active() ? select : nothing;
auto gauge_color = Focused() ? color(Color::White) : color(Color::GrayDark);
return hbox({
text(label_()) | dim | vcenter,
@@ -236,7 +237,7 @@ class SliderWithLabel : public ComponentBase {
text("]"),
}) | xflex,
}) |
gauge_color | xflex | reflect(box_);
gauge_color | xflex | reflect(box_) | focus_management;
}
ConstStringRef label_;