nico3333fr/van11y-accessible-tab-panel-aria

tabs on screen size > x

hans2103 opened this issue · 2 comments

For some projects it might be better not to have tabs on mobile devices.
Can you add a data-attribute to indicate the minimum screen size width where your tabs script should be triggered?

data-tabs-min-width = "768"

if ( $(window).width() > 768) {    
  // start tabs 
}

Hi @hans2103 ,

even if I understand the need, I think it might not be a good idea to set it up using pixels, even from JavaScript.

The reason is simple: for example, if you set up media-queries using em, which allow to have the "mobile" design on desktop with a high zoom value (good for accessibility purposes), the pixel unit is not reliable.

Why not using matchmedias like if (window.matchMedia("(max-width: 60em)").matches) {

I wonder if a "destroy" method would be simpler?

sounds great.... but the idea is the same. The ability to add a data attribute to disable the tabs on mobile devices.