Skip to content

window.getSelection not updated on repeated right-click #657

Open
@Arithmomaniac

Description

@Arithmomaniac

Using a registered event similar to this:

$.contextMenu({
        selector: ".foo",
        build: function($triggerElement, e){
            console.log(window.getSelection().getRangeAt(0));
            return {zIndex: 10, items: getMenuItems(), reposition: false};
        }
    })

If I repeatedly right-click (as in #104) on a text element, the logged message remains the same; window.getSelection() is not updated. This is despite having reposition: false.

I tested this with the browser's native context menu:

document.addEventListener("selectionchange", function(e) {
  console.log(window.getSelection().getRangeAt(0));
});

and that does refresh.

using jQuery.contextMenu v2.7.0, Chrome 67

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions