You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
fix resizing sometimes not working (and selecting text)
Last friday a child <div> was added inside the ResizeHandle component, which made the parentElement/classList checks fail on the event.target here. This would only fail (and select all the text) when dragging exactly on the grey line (the div), not the transparent margin around it. use closest to make sure we have the root element of the handle.
This commit is contained in:
@@ -84,8 +84,10 @@ export class Resizer {
|
||||
}
|
||||
|
||||
_onMouseDown(event) {
|
||||
const target = event.target;
|
||||
if (!this._isResizeHandle(target) || target.parentElement !== this.container) {
|
||||
// use closest in case the resize handle contains
|
||||
// child dom nodes that can be the target
|
||||
const resizeHandle = event.target && event.target.closest(`.${this.classNames.handle}`);
|
||||
if (!resizeHandle || resizeHandle.parentElement !== this.container) {
|
||||
return;
|
||||
}
|
||||
// prevent starting a drag operation
|
||||
@@ -96,7 +98,7 @@ export class Resizer {
|
||||
this.container.classList.add(this.classNames.resizing);
|
||||
}
|
||||
|
||||
const {sizer, distributor} = this._createSizerAndDistributor(target);
|
||||
const {sizer, distributor} = this._createSizerAndDistributor(resizeHandle);
|
||||
|
||||
const onMouseMove = (event) => {
|
||||
const offset = sizer.offsetFromEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user