fix resize to only work with left mouse click (#10546)

Co-authored-by: Neeraj <neerajv@thirdrocktechkno.com>
Co-authored-by: Kerry <kerrya@element.io>
This commit is contained in:
Neeraj Vageele 2023-04-11 11:43:11 +05:30 committed by GitHub
parent 144b2c7e15
commit c8585be2f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,6 +114,10 @@ export default class Resizer<C extends IConfig = IConfig> {
}
private onMouseDown = (event: MouseEvent): void => {
const LEFT_MOUSE_BUTTON = 0;
if (event.button !== LEFT_MOUSE_BUTTON) {
return;
}
// use closest in case the resize handle contains
// child dom nodes that can be the target
const resizeHandle = event.target && (<HTMLDivElement>event.target).closest(`.${this.classNames.handle}`);