web-components icon indicating copy to clipboard operation
web-components copied to clipboard

Grid column reordering error when cursor leaves the browser.

Open nSharifA opened this issue 1 year ago • 1 comments

Description

I wanted to move the last grid column to first position, while doing that cursor left the browser for a moment and I got a javascript error at the top right corner: "TypeError: Cannot read properties of null (reading '_column')"

Full console stacktract:

vaadin-grid-column-reordering-mixin.js:255 Uncaught TypeError: Cannot read properties of null (reading '_column')
    at GridElement._cellFromPoint (vaadin-grid-column-reordering-mixin.js:255:18)
    at GridElement._onTrack (vaadin-grid-column-reordering-mixin.js:166:29)
    at GridElement._onTrackEvent (vaadin-grid-column-reordering-mixin.js:121:12)
    at _fire (gestures.js:682:87)
    at trackFire (gestures.js:982:3)
    at HTMLDocument.movefn (gestures.js:879:11)

Video: https://github.com/user-attachments/assets/6cfa169d-3664-4e7f-9bd0-82a22f4156a4

Expected outcome

no error

Minimal reproducible example

public class TestUI extends VerticalLayout {

  public TestUI() {

    Grid<List<String>> a = new Grid();
    a.setItems(Arrays.asList(""));
    add(a);
    a.addColumn( l -> "A").setHeader("A").setWidth("200px");
    a.addColumn( l -> "B").setHeader("B").setWidth("200px");
    a.addColumn( l -> "C").setHeader("C").setWidth("200px");
    a.setColumnReorderingAllowed(true);
    a.setSizeFull();
    setSizeFull();
    
  }
}

Steps to reproduce

  1. add the snipet
  2. make the browser smaller.
  3. drag the last column to the first position, leave the browser with the cursor while doing that

Environment

Vaadin version(s): 14.10.11 OS: Windows10

Browsers

Chrome

nSharifA avatar Aug 22 '24 12:08 nSharifA

The issue seems to be fixed on the latest version.

yuriy-fix avatar Aug 22 '24 13:08 yuriy-fix