Make links not focusable inside a burger menu

I'm trying to create a keyboard accessible menu, but the problem is if
button
/a/input are in that menu, they are still focusable. To move menu in-n-out I use translateX.
The only solution I can think of is conditionally setting each focusable element's tabIndex to -1, if menu is closed. Yet I wonder is it the best solution out here?
Codepen: https://codepen.io/Kamidashi/pen/poQaYvZ (Just Tab through and you'll get what I mean)
Was this page helpful?