How to make the tabs undraggable?
busaeed opened this issue · comments
I'm trying to disable the draggability of the tabs because I don't need it.
I've found the solution in https://github.com/desandro/draggabilly
In chrome-tabs.js file search for the following code:
draggabilly.on('pointerDown', _ => {
this.setCurrentTab(tabEl)
})
Then add the following line right after:
draggabilly.disable()
A similar solution can be implemented outside of the library, although it’s a bit hacky:
const disableDragging = () => chromeTabs.draggabillies.forEach(d => d.disable())
disableDragging()
chromeTabs.el.addEventListener('tabAdd', () => setTimeout(disableDragging))
chromeTabs.el.addEventListener('tabRemove', () => setTimeout(disableDragging))
(Assumes chromeTabs = new ChromeTabs()
instance.)
You can paste this into the DevTools console on adamschwartz.co/chrome-tabs to try it out for yourself.
I’m also open to a PR which makes this an settings option for the library.