You may add a `return` statement for the `default` case, then call `preventDefault` after the `switch` clause. It would be easier to read.

Please refer to the function above this one.