Are tabs bad?

October 5th, 2022

No, of course not.

They are hard as fuck to make accessible or to work in a sensible way though.

Oh, you want an example? How about you have a form with a required field that is not filled out, but is in a hidden tab pane and you then submit the form... how can the browser focus/show the form element and display its warning to the user?  Answer: it can't, but you can make it with excruciating effort in lots of browser specific ways.

What's the solution?

The only one I can come up with is... fuck tabs.

Just make a regular nav with anchor links to the top of your 'sections' where the tab content panes would normally begin. Make the nav sticky if you really want (using regular css) - also make it accessible by... just using half decent markup.  Oh, hey, it even handles #urls automatically. The only downside is a slightly longer page with some scrolling. Boo hoo.