Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component: TreeTable, dragging over table cells #14512

Closed
mbraeuner opened this issue Jan 8, 2024 · 2 comments
Closed

Component: TreeTable, dragging over table cells #14512

mbraeuner opened this issue Jan 8, 2024 · 2 comments
Assignees
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@mbraeuner
Copy link

mbraeuner commented Jan 8, 2024

Describe the bug

When using TreeTable with pDroppable on a table row, the table row will lose highlighting class "p-draggable-enter" if you move the mouse cursor outside the table cell (td) in the same row (tr)

Bildschirmaufzeichnung.vom.08.01.2024.21.59.46.webm

Environment

Angular 17.0.8

Reproducer

https://stackblitz.com/edit/github-egxv1j-zufyea

Angular version

17.0.8

PrimeNG version

17.3.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v20.10.0

Browser(s)

chrome 120.0.6099.199 64-bit

Steps to reproduce the behavior

https://stackblitz.com/edit/github-egxv1j-zufyea

  1. drag row from first table
  2. drag it to a cell on the second table
  3. move the cursor in the same row of the second table to another cell of the same row
    => current row will loose the class p-draggable-enter to highlight the drop target

Expected behavior

while dragging an element in the same table row between different cells, the row should not lose class "p-draggable-enter"

@mbraeuner mbraeuner added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 8, 2024
@mbraeuner mbraeuner changed the title TreeTable dragging over table cells Component: TreeTable, dragging over table cells Jan 9, 2024
@mbraeuner
Copy link
Author

mbraeuner commented Jan 9, 2024

further investigation into this case. The drag enter for the new element will be called before the dragleave of the old element.

The following code is not a fix. I'ts just for testing. I delayed the addClass to the next event cycle in the dragdrop.ts of primeng/dragdrop

    @HostListener('dragenter', ['$event'])
    dragEnter(event: DragEvent) {
        event.preventDefault();

        if (this.dropEffect) {
            (event.dataTransfer as DataTransfer).dropEffect = this.dropEffect;
        }
        // delay addClass
        setTimeout(() => {
            DomHandler.addClass(this.el.nativeElement, 'p-draggable-enter');
        });

        this.onDragEnter.emit(event);
    }

I think a fix could be to handle the drag events only if the element with the pDroppable has been entered or left with the cursor.

@mertsincan
Copy link
Member

Thanks a lot for your report! I set a milestone for it and we'll check it before the milestone is released. Also, I appreciate if you support us with PR.

@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 16, 2024
@mertsincan mertsincan added this to the 17.4.0 milestone Jan 16, 2024
@cetincakiroglu cetincakiroglu modified the milestones: 17.4.0, 17.5.0 Jan 24, 2024
@cetincakiroglu cetincakiroglu added the Status: Discussion Issue or pull request needs to be discussed by Core Team label Jan 25, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team Status: Discussion Issue or pull request needs to be discussed by Core Team labels Feb 1, 2024
@cetincakiroglu cetincakiroglu self-assigned this Feb 1, 2024
@cetincakiroglu cetincakiroglu added the LTS-PORTABLE Issue's fix will be ported to supported LTS versions label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants