Draggable: no way to prevent Focusable plugin from modifying DOM

Created on 27 Jan 2019  路  3Comments  路  Source: Shopify/draggable

1. Apply either the bug or feature-request label

feature-request

2. Describe the bug or feature

Currently, a few plugins are added by default including Focusable.

We're implementing our own keyboard control, and Focusable is adding tabindex attributes to nodes that shouldn't have them.

The docs say to disable plugins using sortable.removePlugin(Draggable.Plugins.Focusable), but it appears that by the time this code runs, the Focusable plugin has already modified the DOM.

3. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

const sortable = new Sortable(element, {});
sortable.removePlugin(Draggable.Plugins.Focusable);
console.log("Expect to be -1: ", element.tabIndex)

As a work-around, I need to manually update the tabIndex values after removing the plugin.

4. Please tell us about your environment:

  • Library version: 1.0.0-beta.8
  • Browsers: all
  • Tech stack: ES5

Most helpful comment

Sorry for late respond, I just joined maintainers team,

For this problem, I think we should have an option to allow user disable built-in plugins before constructing the Draggable/Sortable.

The other side, Focusable plugin itself should remove all modifications when it was removed.

I will try to create PR at this weekend 馃槃

All 3 comments

A quick and dirty workaround for this is to delete Draggable.Plugins.Focusable before constructing the Draggable/Sortable.

Sorry for late respond, I just joined maintainers team,

For this problem, I think we should have an option to allow user disable built-in plugins before constructing the Draggable/Sortable.

The other side, Focusable plugin itself should remove all modifications when it was removed.

I will try to create PR at this weekend 馃槃

thanks!

Was this page helpful?
0 / 5 - 0 ratings