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

Specifying parentDocumentElementID prevents mouseevents from reaching the parent #30

Open
sudsy opened this issue Feb 13, 2017 · 0 comments
Labels

Comments

@sudsy
Copy link

sudsy commented Feb 13, 2017

I noticed this behaviour while implementing controlKit.

I have found a fix which involves changing:

    if (!options.parentDomElementId) {
        node = new Node();
        document.body.appendChild(node.getElement());
    } else {
        node = Node.getNodeById(options.parentDomElementId);
    }

to

    if (!options.parentDomElementId) {
        node = new Node();
        document.body.appendChild(node.getElement());
    } else {
	node = new Node();
        document.getElementById(options.parentDomElementId).appendChild(node.getElement());
    }

Ideally though, I would like it to be something more like this to allow a domElement to be passed rather than referenced by id

    var rootElement = document.body;
    if (options.parentDomElement) {
        rootElement = options.parentDomElement
    } else if(options.parentDomElementId){
        rootElement = document.getElementById(options.parentDomElementId)
    }
    node = new Node();
    rootElement.appendChild(node.getElement());

I will make these changes in my own fork and will submit a PR if you would like to merge the changes.

sudsy referenced this issue in sudsy/controlkit.js Feb 16, 2017
Add ability to pass domElement directly too.
@automat automat added the bug label Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants