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

TreeTable: Node unexpectedly gets selected when I expand it #6936

Closed
moduly-solutions-slechner opened this issue Dec 8, 2024 · 3 comments
Closed
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@moduly-solutions-slechner
Copy link

moduly-solutions-slechner commented Dec 8, 2024

Describe the bug

In the TreeTable Component, when I expand a row, in some cases the parent node gets selected (and therefore the @node-select event gets fired). I spent some time to reproduce this issue and after a while I found out, that this only happens, if the expansion action is done by clicking somewhere on the round expansion button/area (defined by "expander" tag on a Column) outside the "down-arrow" icon. So I feel like the issue is that the selection event is not properly bind to the whole click area, but only the icon itself. (See stackblitz)

Reproducer

https://stackblitz.com/edit/primevue-4-ts-vite-issue-template-fmv9y7dc?file=src%2FApp.vue

PrimeVue version

4.2.4

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Make a simple TreeTable with parent and child node and try to expand and collapse the child node. Check with @node-select when a selection is triggered and you will see that sometimes, expansion triggers it.

Expected behavior

On expansion, I don't expect the parent node to be marked as selected.

@moduly-solutions-slechner moduly-solutions-slechner added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 8, 2024
@moduly-solutions-slechner
Copy link
Author

Oh, I've just seen that this issue is also explained here: #6932

@KriXPello
Copy link
Contributor

@moduly-solutions-slechner i can suggest temporary solution:

const originalGetAttribute = Element.prototype.getAttribute;
Element.prototype.getAttribute = function (name) {
  const realValue = originalGetAttribute.call(this, name);
  if (name === 'data-pc-section' && realValue == 'nodetoggleicon') {
    return 'rowtoggleicon';
  }
  return realValue;
};

@moduly-solutions-slechner
Copy link
Author

@KriXPello cheers mate, works fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants