Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation results in draggable behaviour for entire page #49

Open
kaerumy opened this issue Aug 12, 2015 · 12 comments
Open

Installation results in draggable behaviour for entire page #49

kaerumy opened this issue Aug 12, 2015 · 12 comments

Comments

@kaerumy
Copy link

kaerumy commented Aug 12, 2015

1.0rc2 apparently enables draganddrop jquery function for entire page, so that it's no longer possible select text. (jqueryui 1.10.3)

@kaerumy
Copy link
Author

kaerumy commented Aug 13, 2015

Installing via portal_quickinstaller adds ui-draggable class to body, resulting in this behavior.

@hvelarde
Copy link
Member

it should be something one of the jQuery add-on; I think we haven't change anything related with that.

@rafaelbco
Copy link

@hvelarde I'm facing this same issue. I've found out that if I comment out the line which reads $(this).data("init", true).draggable(opts); in related.js then the problem is solved and the related items widget still works.

I'm wondering, what in this widget needs to be draggable anyway ?

@hvelarde
Copy link
Member

@rafaelbco I have no idea :-)

@rafaelbco
Copy link

@hvelarde I'll make a pull request fixing the issue by removing stuff related to the draggable behavior.

If you know somebody who can understand the code in related.js and validate the changes please contact them 😄

@rafaelbco
Copy link

Actually, I was wrong. Commenting out the said line really fixes the issue, but I don't know if the related items widget keeps working. I thought I was using this widget but I'm not. So I'll not submit a pull request right now. Sorry 😞

@hvelarde
Copy link
Member

this package is in maintenance mode, guys; I have no time/resources for fix things here.

feel free to take action.

@agitator
Copy link
Member

does anybody have an idea why

$(this).data("init", true).draggable(opts); 

was added at all?
... it bit me as well :-(

@agitator
Copy link
Member

forget the my above msg, in my case problem was orginated from too recent jquerytools, plone.app.jquerytools = 1.6.2 solved it for me

@pnicolli
Copy link
Member

Downgrading plone.app.jquerytools to 1.6.2 didn't work for me.
A temporary workaround that worked for me is downgrading to collective.z3cform.widgets = 1.0b11 and adding jquery migrate.

@rafaelbco
Copy link

Here's my workaround. Call this function from a document.ready event handler:

    var removeDraggableDoBody = function() {
        // Abort if draggable behavior does not exists.
        if (!$.fn.draggable) {
            return;
        }

        var $body = $('body');

        function removeDraggableFromBody() {
            if ($body.hasClass('ui-draggable')) {
                $body.draggable('destroy');
            }
        }

        // Tries to remove behavior if already active.
        removeDraggableFromBody();

        // Wait for behavior activation and immediately disables it.
        $body.on('dragcreate', function(event, ui) {
            removeDraggableFromBody();
        });
    };

@mauritsvanrees
Copy link
Member

I just ran into this. This is on a website that first had collective.z3cform.widgets 1.0rc1, Plone 4.3.18 and collective.cover 1.7b3, which had no problem. I upgraded it to Plone 4.3.20 and collective.cover 2.2.2 , resulting in the whole page being draggable.
The relevant change here is likely collective.cover, which in version 2 removed all its javascript files from portal_javascripts in favour of doing this in a viewlet. I guess the previous cover version had some javascript that somehow prevented this bug from showing up.

My solution/workaround: disable related.js in portal_javascripts. In profiles/default/jsregistry.xml in a custom package:

<javascript id="++resource++collective.z3cform.widgets/related.js" enabled="False" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants