tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3k stars 252 forks source link

History box expands even if unticked #103

Closed danmed closed 4 years ago

danmed commented 4 years ago

Tested in Firefox and Chrome (both latest) on Windows 10.

Navigate to the page, untick the history, start typing.. the box expands anyway.

mtlynch commented 4 years ago

Thanks! I'll see if I can reproduce this.

somik123 commented 4 years ago

Confirmed issue on Vivaldi as well.

@mtlynch

Change lines 261 to 268 on app.js (https://github.com/mtlynch/tinypilot/blob/master/app/static/js/app.js) from:

function onDisplayHistoryChanged(evt) {
  if (evt.target.checked) {
    document.getElementById("recent-keys").style.visibility = "visible";
  } else {
    document.getElementById("recent-keys").style.visibility = "hidden";
    limitRecentKeys(0);
  }
}

to

function onDisplayHistoryChanged(evt) {
  if (evt.target.checked) {
    document.getElementById("recent-keys").style.display = "";
  } else {
    document.getElementById("recent-keys").style.display = "none";
    limitRecentKeys(0);
  }
}

Or, better yet, change it to use the function that you already declared:

function onDisplayHistoryChanged(evt) {
  if (evt.target.checked) {
    showElementById("recent-keys");
  } else {
    hideElementById("recent-keys");
    limitRecentKeys(0);
  }
}