primeng icon indicating copy to clipboard operation
primeng copied to clipboard

disabled p-toggleswitch doesn't show pTooltip

Open bvx5009 opened this issue 9 months ago • 4 comments

Describe the bug

When using p-toggleswitch with disabled flag, the pTooltip doesn't show.

can easily wrap the p-toggleswitch around with a span as a workaround but still..

Pull Request Link

No response

Reason for not contributing a PR

  • [x] Lack of time
  • [ ] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/8whmy3wp?file=src%2Fapp%2Ftoggleswitch-disabled-demo.ts

Environment

just regular primeng demo environment

Angular version

21.0.0

PrimeNG version

v21

Node version

20.19.1

Browser(s)

No response

Steps to reproduce the behavior

add pTooltip to a p-toggleswitch and set disabled to true

Expected behavior

tooltip should hover about the p-toggleswitch

bvx5009 avatar Mar 04 '26 15:03 bvx5009

https://github.com/primefaces/primeng/issues/13797

Tooltips do not work on any disabled elements in general in PrimeNG. It is apparently "intended behaviour"...

gianluca-moro avatar Mar 12 '26 13:03 gianluca-moro

weird, I saw it was working for a p-button so I thought why not anything else? i updated the demo to have the disabled button

looks like its inconsistent across different elements :/

bvx5009 avatar Mar 12 '26 13:03 bvx5009

This issue has been automatically marked as stale due to a lack of activity. If this issue is still relevant to you, please leave a comment so we can keep it open. We apologize for not being able to prioritize it sooner. If you have any new information or questions, please share them in your comment!

github-actions[bot] avatar Sep 09 '26 00:09 github-actions[bot]

Hi,

Thanks for the report. This is by design, so we're closing it.

A disabled Tab, like other components that mark their disabled state with the p-disabled class, ignores mouse events on purpose: the shared style sets pointer-events: none on it and on everything inside it, so a tooltip on the tab itself never receives a hover. Keyboard navigation skips a disabled tab as well, so a tooltip on it would only reach mouse users.

For a standalone component such as ToggleSwitch, the workaround is to put the tooltip on a wrapper element, for example <span pTooltip="..."><p-toggleswitch [disabled]="true" /></span>. We don't recommend that for a tab: the tab list moves focus between neighbouring tabs with the arrow keys, and a wrapper around one tab breaks that navigation. For a disabled tab, give the reason as visible text instead, for example in the tab label or next to the tab list.

cetincakiroglu avatar Nov 25 '26 13:11 cetincakiroglu