drag-drop-touch-js/dragdroptouch

Breaks Bootstrap 3 dropdown menu

freescout-helpdesk opened this issue · 3 comments

Somehow this Polyfill breaks Bootstrap 3 dropdown submenu functionality on mobile devices: freescout-help-desk/freescout#3708

Maybe we can come up with some quick hack not to apply this Polyfill to the Bootstrap menu.

Quick hack:

        DragDropTouch.prototype._shouldHandle = function (e) {
            // Fix Bootstrap submenu.
            // https://github.com/freescout-helpdesk/freescout/issues/3708
            if (typeof(e.target) != "undefined") {
                if (e.target.classList.contains('dropdown-toggle')) {
                    return false;
                }
                if (e.target.tagName == 'A'
                    && typeof(e.target.parentElement) != "undefined"
                    && typeof(e.target.parentElement.parentElement) != "undefined"
                    && e.target.parentElement.parentElement.classList.contains('dropdown-menu')
                ) {
                    return false;
                }

            }
            return e &&
                !e.defaultPrevented &&
                e.touches && e.touches.length < 2;
        };

I'm closing this mostly because of how much time has passed and how much the code has changed since this issue was filed. If this is still a concern, please file a new issue. I recently signed on to this project and would like to make sure we're covering all the bases, while also making sure there are no lingering issues based on old code.