chameleon icon indicating copy to clipboard operation
chameleon copied to clipboard

Tooltips not working properly

Open D-Groenewegen opened this issue 8 years ago • 3 comments

MW 1.28.0 + Chameleon

Tooltips are currently an opt-in for Bootstrap (https://getbootstrap.com/docs/3.3/javascript/#tooltips) and to enable this plugin, I added the following to MediaWiki:Common.js,

/* Tooltip */ $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip(); });

This seems to be working most of the time, but it can also lead to javascript conflicts, with the console spitting out an error message of the type

TypeError: $(...).tooltip is not a function

Whenever this error message is brought up on the web, comments usually to point to a conflict between jQuery (UI) and Bootstrap (minified or otherwise), which rely on the same function name. It could be the way and order in which the scripts are called, but it need not be.

Bootstrap does offer its "noConflict()" clause, but this is reported to have no effect in this case. Also, it admits on the same page that third-party plugins like jQuery UI may not play along nicely. One user on StackOverflow has gone as far as suggesting that $.widget.bridge could be used to rename jQuery's version of the tooltip. Some relevant discussion here: https://github.com/twbs/bootstrap/issues/6303

What do you think is the best approach here?

D-Groenewegen avatar Sep 03 '17 09:09 D-Groenewegen

No idea. I was not aware of the problem. Are you sure it's from a conflict? Because as far as I can tell jquery.ui.tooltip is not loaded by default (the module jquery.ui.module is not mentioned).

s7eph4n avatar Sep 03 '17 13:09 s7eph4n

Are you sure it's from a conflict?

Not at all! Also, I'm not sure if it's related, but warnings are emitted about deprecated ResourceLoader modules ("jquery.effects.core", "jquery.ui.widget", and "jquery.ui.core"). Will let you know when I've been able to dig a little deeper.

D-Groenewegen avatar Sep 04 '17 20:09 D-Groenewegen

Those deprecation warnings should not be a problem. Well, for that moment that is. At some point the responsible dev will have to fix it. Might be me. Depends on the source of the warning. :grin:

s7eph4n avatar Sep 04 '17 20:09 s7eph4n

Closing this because so much has changed since 2017.

D-Groenewegen avatar Feb 29 '24 13:02 D-Groenewegen