igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Null reference error is thrown when dragged row goes out of viewport

Open ymita opened this issue 7 years ago • 4 comments

Description

Null reference error is thrown when dragged row goes out of viewport.

  • igniteui-angular version: 8.1.2
  • browser: IE11

Steps to reproduce

  1. Run the dev sample
  2. Go to "gridRowDrag" page
  3. Drag a row upward to go out of viewport

Result

Null reference error is thrown.

Expected result

No error is thrown.

Attachment

drag-and-drop error

ymita avatar Aug 06 '19 07:08 ymita

If the returned value of document['msElementsFromPoint'] is null, returning an empty array prevents the error.

protected getElementsAtPoint(pageX: number, pageY: number) {
    // correct the coordinates with the current scroll position, because
    // document.elementsFromPoint consider position within the current viewport
    // window.pageXOffset == window.scrollX; // always true
    // using window.pageXOffset for IE9 compatibility
    const viewPortX = pageX - window.pageXOffset;
    const viewPortY = pageY - window.pageYOffset;
    if (document['msElementsFromPoint']) {
        // Edge and IE special snowflakes
        const elements = document['msElementsFromPoint'](viewPortX, viewPortY);
        return elements === null ? [] : elements;
    } ...
}

ymita avatar Aug 06 '19 07:08 ymita

@ymita I have tested and applied your proposed fix.

dafo avatar Aug 06 '19 13:08 dafo

@dafo Thank you!!

ymita avatar Aug 07 '19 04:08 ymita

@Lipata @dafo This issue is going to be fixed in both 8.x and 7.x, isn't it? If so, can you add corresponding version labels? Thanks.

ymita avatar Aug 19 '19 00:08 ymita