Angular-tree-component: drag'n'drop in FireFox

Created on 2 Dec 2016  路  5Comments  路  Source: CirclonGroup/angular-tree-component

Doesn't work.

FF v50.0.2
tree v2.4.0
lodash v4.17.2

bug Priority

Most helpful comment

Hi, everyone.

Any ideas whether this will be fixed anytime soon?

All 5 comments

True, but very strange. FF should support HTML5 drag'n'drop completely.

Hi, everyone.

Any ideas whether this will be fixed anytime soon?

@adamkleingit

Please give us some info on this issue.

@adamkleingit Cannot make a pull request(no permission?) but the fix is pretty easy. According to http://stackoverflow.com/questions/19055264/why-doesnt-html5-drag-and-drop-work-in-firefox we have to set data for Firefox drag and drop to work. So inside tree-drag.directive.ts should change

@HostListener('dragstart') onDragStart() {
    setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
  }

to

  @HostListener('dragstart', ['$event']) onDragStart(ev) {
    // setting the data is required by firefox
    ev.dataTransfer.setData("text/plain", ev.target.id);

    setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
  }

and then drag and drop works in Firefox.

Hey,
I'll review it and hopefully merge today / tomorrow.
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olastor picture olastor  路  5Comments

mmallit picture mmallit  路  5Comments

nicolae536 picture nicolae536  路  5Comments

Gillardo picture Gillardo  路  5Comments

CC84 picture CC84  路  4Comments