jonmbake / react-terminal-ui

A terminal react component with support for light and dark modes.
https://jonmbake.github.io/react-terminal-ui/demo/
MIT License
212 stars 32 forks source link

Terminal steals focus from other elements on the page #2

Closed jonmbake closed 3 years ago

jonmbake commented 3 years ago

Describe the bug Clicking on another element on the page does not move focus to that element, instead focus remains on the terminal. This is because we are using document.onclick to maintain terminal focus.

To Reproduce

  1. Add react-terminal-ui to page
  2. Add another element like an input
  3. Try to click on the input
  4. Notice focus does not go to input, but remains on terminal

Expected behavior It should be possible to focus on other elements on the page. We should avoid using document.onclick.

Screenshots N/A

Additional context Originally discussed in https://github.com/jonmbake/react-terminal-ui/pull/1.