chameleon
chameleon copied to clipboard
Tooltips not working properly
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?
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).
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.
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:
Closing this because so much has changed since 2017.