Skip to content

Commit

Permalink
Turn browser autocomplete off whan arrow is pressed
Browse files Browse the repository at this point in the history
Turn browser autocomplete off and use command history as soon as an arrow key is pressed allowing mobiles and tablets to keep using browser autocomplete. (#8015)
  • Loading branch information
arendst committed Mar 30, 2020
1 parent 4631fb7 commit 490a7f2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tasmota/xdrv_01_webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"var hc=[],cn=0;" // hc = History commands, cn = Number of history being shown
"function cH(a){"
"var b=qs('#c1'),c=a.keyCode;" // c1 = Console command id
"if(38==c||40==c){b.autocomplete='off';}" // Arrow up or down must be a keyboard so stop browser autocomplete
"38==c?(++cn>hc.length&&(cn=hc.length),b.value=hc[cn-1]||''):" // Arrow Up
"40==c?(0>--cn&&(cn=0),b.value=hc[cn-1]||''):" // Arrow Down
"13==c&&(hc.length>19&&hc.pop(),hc.unshift(b.value),cn=0)" // Enter, 19 = Max number -1 of commands in history
Expand Down

0 comments on commit 490a7f2

Please sign in to comment.