Skip to content

Cursor gets lost with empty sub-container below toggle #1067

@scd31

Description

@scd31

Hello,

First of all, awesome library! I've been using it for the last week or so to build a little TUI softphone and it's been great.

I think I found a small UI bug, or I'm doing something wrong. I have a vertical container containing a toggle and another vertical container. This inner vertical container contains an empty horizontal container and a button.

If I launch the project and press the down arrow, my cursor disappears! If I press the down arrow again, it reappears on the button. From there, the UI seems to have "learned" the correct behaviour, and clicking up/down once correctly goes between the toggle and the button.

I threw together a minimum reproducible example: https://gitlab.scd31.com/stephen/ftxui-bug-repro

Here's my main.cpp, if you don't want to click through:

#include <ftxui/component/component.hpp>
#include <ftxui/component/event.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>

using namespace ftxui;

int main() {
  auto term = ScreenInteractive::Fullscreen();

  auto btn1 = Button("button 1", [] {});

  auto containerTab1 = Container::Vertical({Container::Horizontal({}), btn1});

  std::vector<std::string> tabValues{
      "Tab1",
  };

  int tabSelected = 0;
  auto tabToggle = Toggle(&tabValues, &tabSelected);

  auto container = Container::Vertical({tabToggle, containerTab1});

  auto renderer = Renderer(container, [&] { return container->Render(); });

  term.Loop(renderer);

  return 0;
}

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions