Igniteui-angular: Null reference error is thrown when dragged row goes out of viewport

Created on 6 Aug 2019  路  4Comments  路  Source: IgniteUI/igniteui-angular

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

IE-11 edge bug general row-drag high resolved 7.3.x 8.1.x 8.2.x

All 4 comments

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 I have tested and applied your proposed fix.

@dafo Thank you!!

@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.

Was this page helpful?
0 / 5 - 0 ratings