← Back to context

Comment by wky

4 hours ago

They do that, yet proceed to kneecap the perceived latency by delaying the render.

> And on keyUp (the user releases the key), we render the suggestions.

There are a large number of edge cases where rendering it on key down would not be desirable (user types Ctrl+v, how accented characters are enetered, how some Asian languages get handled, backspace/delete, user holds a key down, etc). This is getting into the point of optimization where it simply does not matter and can actually harm things

  • Holding a key would indeed require both on key down and up. I'd still argue that handling rerender on key down (or to fully match whatever OS/browser semantics, oninput) makes more sense than key up. Pressing Ctrl+V for example produces feedback as soon as "V" is pressed, not when Ctrl and/or V is released.

    Interestingly Ctrl+V on OP's website does update immediately when Ctrl+V is pressed.