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

On drag - header/background text selection (Chrome/Firefox) #5

Open
ghost opened this issue Sep 5, 2011 · 2 comments
Open

On drag - header/background text selection (Chrome/Firefox) #5

ghost opened this issue Sep 5, 2011 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 5, 2011

When you drag a dialog quickly in chrome and FF, the header text still gets selected along with any background elements you pass over.

Fix: Simply add return false; to the end of the _dragStart method to cancel selection.

_dragStart: function (event)
{
    if (event.rightClick) return;

    MUX.Dialog.currentDialogParams = {
        box: this.box,
        mouse: {
            x: event.client.x,
            y: event.client.y
        },
        browser: $(window).getSize()
    }

    $(document).addEvents({
        mousemove: MUX.Dialog._dragMoving,
        mouseup: MUX.Dialog._dragEnd
    });

    return false;
}

Seriously though, I love this class. Very elegant!

@ghost
Copy link
Author

ghost commented Sep 5, 2011

Just found a problem with the fix -- if you click outside the dialog, and try to click back onto it via the header it doesn't re-add .mux-dialog-focused. It does on the dialog body however.

@ghost
Copy link
Author

ghost commented Sep 5, 2011

The temporary fix I put in place was to add/remove a CSS class for the document.body element during _dragMoving and _dragEnd

.mux-body-dialog-moving {
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

with the following script changes:

MUX.Dialog._dragMoving = function (event)
{
    ...

    params.box.addClass('mux-dialog-moving');
    document.body.addClass('mux-body-dialog-moving');

    ...
}


MUX.Dialog._dragEnd = function (event)
{
    MUX.Dialog.currentDialogParams.box.removeClass('mux-dialog-moving');
    document.body.removeClass('mux-body-dialog-moving');

    ...
}

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

0 participants