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

Proper click event processing when scrolled down #137

Open
Bohdan-Tereta opened this issue Apr 23, 2014 · 8 comments
Open

Proper click event processing when scrolled down #137

Bohdan-Tereta opened this issue Apr 23, 2014 · 8 comments
Labels
Milestone

Comments

@Bohdan-Tereta
Copy link

If a page is scrolled down so there are no column headers with "repdate" attribute in the viewport, click event doesn't work. Debugger shows that "col value is null'. Issue may be caused by using of custom implementation of elementFromPoint function. ElementFrom, according to documentation, should return null or element at specified position in viewport. But in case of scrolled page it will return null for any element outside visible part of the page.
Here's the code that fixed the problem for me (commented code replaced with uncommented part). I'd like to see it tested for different configurations and in the end included into library.

                // Find column where click occurred
                //var col = core.elementFromPoint(e.pageX, datapanel.offset().top + corrY);
                //// Was the label clicked directly?
                //if (col.className === "fn-label") {
                //    col = $(col.parentNode);
                //} else {
                //    col = $(col);
                //}

                var col;
                $(document).find("div[class^='row date']").each(function () {
                    var boundingClientRect = this.getBoundingClientRect();
                    if (boundingClientRect.right > e.pageX && boundingClientRect.left < e.pageX
                        && boundingClientRect.bottom + tools.getCellSize() < e.pageY) //optional, prevents click on gantt header
                    {
                        col = $(this);
                    }
                });

P.S. I think something similar should be applied for row variable in order to enable proper click event processing when left panel gets out of viewport.

@usmonster usmonster added the bug label Apr 23, 2014
@usmonster
Copy link
Collaborator

Good catch, this will be investigated.

@Bohdan-Tereta, to help debugging, can you say what browser are you using? Also, in the page where you're using the plugin, what is the value of document.compatMode? If you could also provide a jsbin or jsfiddle of a simple instance of the bug, that would be very helpful. Thanks!

@Bohdan-Tereta
Copy link
Author

Firefox 28.0 and Firefox 22.0 are my target browsers now, document.compatMode='CSS1Compat' (Strict mode). I reproduced that on Chrome 34 too, in the same document.compatMode. I will send jsfiddle instance of bug as soon as I create it.

@Bohdan-Tereta
Copy link
Author

http://jsfiddle.net/Bohdan_Tereta/bXN3C/23/
Step 1. Just click anywhere on datapanel except for pink labels.
Expected result: Alert appears.
Actual result: Alert doesn't appear.
Step 2. Scroll to the top of the page so the header is shown.
Expected result: Alert appears.
Actual result: Alert appears.

@Bohdan-Tereta
Copy link
Author

Why is it still labeled "needs input"? Isn't provided input enough? Should I provide some more input?..

@usmonster
Copy link
Collaborator

Hi @Bohdan-Tereta, thanks again for your input. The bug is confirmed, I've removed the label.

@usmonster usmonster modified the milestone: n+2 Dec 24, 2014
@kelmer44
Copy link

kelmer44 commented Jun 9, 2015

Is there any workaround for this?

@slovely
Copy link

slovely commented Jun 9, 2015

@Bohdan-Tereta's fix detailed above has worked for me.

@kelmer44
Copy link

kelmer44 commented Jun 9, 2015

Unfortunately it does not work on me :(

Repository owner deleted a comment from ATwins-8 Jun 25, 2018
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

4 participants