Right click outside the table throw exception: Cannot read properties of undefined (reading 'getBoundingClientRect')
rceraline opened this issue · 2 comments
Hi,
I noticed an error when using the table. Here is the repro steps:
- Insert a table
- Click inside a cell to activate the table
- Right click outside the table
Expected behavior: no error
Actual behavior: Cannot read properties of undefined (reading 'getBoundingClientRect')
The scenario can be reproduced here: https://codepen.io/soccerloway/pen/WWJowj
I had this problem too but didn't realize this was the cause!
I was able to workaround it adding a tunneled 'contextmenu' event listener on window and rejecting the right click if a cell is selected and the mouse point on the click is NOT in the table's <tbody>
element's (specifically that element any higher will return the whole block width) bounding client rect. using getBoundingClientRect()
and {x: e.clientX, y: e.clientY}
for the collision detected.