Basically, the first 'wrong' button doesn't count as the first matched button, even if it's the correct one ('up' in this case). Probably the right approach here is to add a generic handler middleware which keeps a buffer of the last n button presses, which further control-code middlewares could use to match against the codes they're configured with.
See this output of the button press events and the value of
matched-prefix-len
:Basically, the first 'wrong' button doesn't count as the first matched button, even if it's the correct one ('up' in this case). Probably the right approach here is to add a generic handler middleware which keeps a buffer of the last n button presses, which further
control-code
middlewares could use to match against the codes they're configured with.