Ngx-bootstrap: The tooltip doesn`t work when the button is disabled

Created on 22 Feb 2019  路  6Comments  路  Source: valor-software/ngx-bootstrap

The tooltip doesn`t work when the button is disabled:
https://stackblitz.com/edit/ngx-bootstrap-tooltip

But it works in the original Bootstrap:
https://getbootstrap.com/docs/4.3/components/tooltips/#disabled-elements

ngx-bootstrap: 3.3.0
Angular: 6.0.3
Bootstrap: 4.1.1

comp(tooltip) question

Most helpful comment

@ludmilanesvitiy
Please read this article: https://jakearchibald.com/2017/events-and-disabled-form-fields/

Probably Chrome and many other browsers stop emitting all mouse events on disabled form fields, including buttons.
Unfortunately there is nothing you can do about it.

@CzechsMix, @mcvova
Workaround:
triggers="pointerenter:pointerout"
Depending on content used inside button it may require to add pointer-events: none; in CSS for them.
Confirmed to work on:

  • Chrome 73.0.3683.86
  • FF 66.0.2
  • IE 11.285.17134.0
  • Edge 42.17134.1.0

All 6 comments

@mcvova Peek 2019-03-19 17-352
Just added a disabled button to our demo, it works properly.

Here's a stackblitz link where I'm not seeing it work

https://angular-iffl92.stackblitz.io/

Browser: Chrome Version 72.0.3626.121 (Official Build) (64-bit)

@ludmilanesvitiy
Please read this article: https://jakearchibald.com/2017/events-and-disabled-form-fields/

Probably Chrome and many other browsers stop emitting all mouse events on disabled form fields, including buttons.
Unfortunately there is nothing you can do about it.

@CzechsMix, @mcvova
Workaround:
triggers="pointerenter:pointerout"
Depending on content used inside button it may require to add pointer-events: none; in CSS for them.
Confirmed to work on:

  • Chrome 73.0.3683.86
  • FF 66.0.2
  • IE 11.285.17134.0
  • Edge 42.17134.1.0

Other way is to use class "disabled" of bootstrap and not to disable button at all. Check whether to invoke action or not can be done inside handler method

Workaround

  • Wrap your button in a span tag.
  • Put the tooltip in that span.

I'm closing the issue. Please use workarounds from messages above if you want to see tooltip for disabled buttons.

Was this page helpful?
0 / 5 - 0 ratings