Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 773b147

Browse files
authored
Add a condition to only activate the resizer which belongs to the clicked handle (#7055)
1 parent 4cbef21 commit 773b147

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/resizer/resizer.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ export default class Resizer<C extends IConfig = IConfig> {
122122
// child dom nodes that can be the target
123123
const resizeHandle = event.target && (<HTMLDivElement>event.target).closest(`.${this.classNames.handle}`);
124124
const hasHandler = this?.config?.handler;
125-
if (!resizeHandle || (!hasHandler && resizeHandle.parentElement !== this.container)) {
125+
// prevent that stacked resizer's are both activated with one mouse event
126+
// (this is possible because the mouse events are connected to the containers not the handles)
127+
if (!resizeHandle || // if no resizeHandle exist / mouse event hit the container not the handle
128+
(!hasHandler && resizeHandle.parentElement !== this.container) || // no handler from config -> check if the containers match
129+
(hasHandler && resizeHandle !== hasHandler)) { // handler from config -> check if the handlers match
126130
return;
127131
}
132+
128133
// prevent starting a drag operation
129134
event.preventDefault();
130135

0 commit comments

Comments
 (0)