Sortable: TypeError: evt.path is undefined

Created on 23 Aug 2017  路  5Comments  路  Source: SortableJS/Sortable

Getting the error when I am trying to sort an element that has shadowRoot. I am using a polyfill for ShadowDOM in Firefox / IE. event.path is not yet available in Firefox / IE.

originalTarget = evt.target.shadowRoot && evt.path[0] || target,

Browsers: Firefox 55 , IE 11

Try this fiddle in Firefox / IE -- http://jsbin.com/cewowicutu/edit?html,js,output

Most helpful comment

Done, thx.

All 5 comments

@RubaXa Please check this.

Done, thx.

Thanks. What is the plan for publishing a new version with the fix?

Hey, I reopen this issue because of Firefox 63 which handle Shadow DOM now. The bug is Firefox doesn't handle evt.path because it's not standard. The equivalent is composedPath. I think we should rewrite how we get originalTarget in order to access the handle element in shadowRoot. Here is a fix:

originalTarget = evt.target.shadowRoot && ((evt.path && evt.path[0]) || (evt.composedPath && evt.composedPath()[0])) || target,

See these for more:

We will create a PR soon to fix this.

Thanks in advance for the review and your time!

Was this page helpful?
0 / 5 - 0 ratings