As RyanDev suggested, the bit you're missing is
e.preventDefault()
.
But why would you change the browser behaviour on tab press?
People with accessibility issues are going to find your website very difficult to use. Lots of people with mobility issues or sight issues are dependant on readers and the limited navigation choices of tab forwards and tab backwards.
Instead you should be managing the order of controls using the
tabIndex
attribute.
tabIndex Attribute[
^]