primevue icon indicating copy to clipboard operation
primevue copied to clipboard

fix(ContextMenu): adjust anchor element selector to execute action on Enter key when the "item" template has been redefined

Open clemvnt opened this issue 1 year ago • 3 comments

fixes #5983.

The selector for the anchor element of the Enter key event is not the same on the ContextMenu and TieredMenu components :

  • TieredMenu : [data-pc-section="action"]
  • ContextMenu : a[data-pc-section="action"]

The problem with the ContextMenu selector is that the Enter key does nothing once the item template has been redefined :

<ContextMenu :model="items">
  <template #item="{ item, props }">
      <div v-bind="{ ...props.action, ...item.attributes }">
        <span>{{ item.label }}</span>
      </div>
  </template>
</ContextMenu>

There's no such problem with the TieredMenu component.

This PR changes the selector to use the same one as the TieredMenu component.

I don't know in which version this fix should be made (3? 4?), I'll let you decide the target branch.

clemvnt avatar Jun 21 '24 08:06 clemvnt

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:08pm
primevue-v3 ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:08pm

vercel[bot] avatar Jun 21 '24 08:06 vercel[bot]

Please create an issue for the PR.

You could also port the PR for v4. Main version is v4.

Thank you!

tugcekucukoglu avatar Jun 27 '24 11:06 tugcekucukoglu

My bad! Here's the issue : #5983

clemvnt avatar Jun 27 '24 15:06 clemvnt

Since I've upgraded to v4, I've changed the target branch to "master".

clemvnt avatar Jul 29 '24 20:07 clemvnt