Proper click event processing when scrolled down
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.
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!
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.
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.
Why is it still labeled "needs input"? Isn't provided input enough? Should I provide some more input?..
Hi @Bohdan-Tereta, thanks again for your input. The bug is confirmed, I've removed the label.
Is there any workaround for this?
@Bohdan-Tereta's fix detailed above has worked for me.
Unfortunately it does not work on me :(