wannabegeek / ng2-split-pane

Split View module for Angular 2
MIT License
43 stars 25 forks source link

Prevent selection when dragging the splitter #3

Closed cpa-level-it closed 7 years ago

cpa-level-it commented 7 years ago

There is a bug where you can select text on the split-pane-content-primary or split-pane-content-secondary element while dragging.

I can reproduce the bug with Firefox but not with Chrome.

To avoid this, I think you should stop the mousedown event for bubbling while dragging.

In split-pane-separator.component.ts :

@HostListener('mousedown', ['$event'])
  onMousedown(event) {
    this.notifyWillChangeSize.emit(true);
    event.preventDefault();    //ADDED THIS
  }

This seems to fix the bug.

wannabegeek commented 7 years ago

Thanks for spotting this. I have updated & create a new release (1.0.6) fixing this.

I have altered it from you implementation to return false which I believe is the angular way of preventing the event from bubbling up;

@HostListener('mousedown', ['$event'])
  onMousedown(event) {
    this.notifyWillChangeSize.emit(true);
    return false;
  }