message: Fix hotkey buttons keeping the listener even after a blur
diff: @@ -88,14 +88,20 @@ export default class HotkeyButton extends React.Component<Props, State> {
  }
  private focusButton() {
  - const listener = {
  + let listener = this.state.listener;
  + let intervalHandle = this.state.intervalHandle;
  +
  + if (listener === null) {
  + listener = {
  handleEvent: (ev: KeyboardEvent) => this.props.setValue(ev.code),
  };
  window.addEventListener("keypress", listener);
  + }
  + if (intervalHandle === null) {
  const oldButtonState: boolean[][] = [];
  - const intervalHandle = window.setInterval(() => {
  + intervalHandle = window.setInterval(() => {
  const gamepads = navigator.getGamepads();
  let gamepadIdx = 0;
  @@ -121,6 +127,7 @@ export default class HotkeyButton extends React.Component<Props, State> {
  gamepadIdx++;
  }
  }, 1000 / 60.0);
  + }
  this.setState({
  listener,
  