bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Fix tooltip selector usage

Open GeoSot opened this issue 3 years ago • 3 comments

As quick fix as many people seems to use old 'black magic' stuff.

NOTE: Please do not use data-bs-original-title . It returned, just to support the strange cases where tooltip are created through selector (explanation: a falsie tooltip is created on a wrapper and adds delegated event listeners), but for some strange reason, new tooltips are supposed to show the same title as the first ones, or to be initialized from a data-attribute that shouldn't exist (title) after the initialization

closes #36895 closes #36813

GeoSot avatar Aug 06 '22 12:08 GeoSot

NOTE: Please do not use data-bs-original-title .

With this fix, we will able to keep selector: '[title]' but we should avoid selector: '[data-bs-original-title]', right? If so, thank you so much, it saves me! ❤

Rezyan avatar Aug 09 '22 00:08 Rezyan

You may do a test on your code using this script https://deploy-preview-36914--twbs-bootstrap.netlify.app/docs/5.2/dist/js/bootstrap.bundle.min.js and feedback me. I am not so sure that you can use title as selector. Especially if you clone an already initialized instance.

Note: the only sure is that can be reverted just letting title empty, but it is not a valid way to leave the attribute empty

GeoSot avatar Aug 09 '22 09:08 GeoSot

You may do a test on your code using this script https://deploy-preview-36914--twbs-bootstrap.netlify.app/docs/5.2/dist/js/bootstrap.bundle.min.js and feedback me. I am not so sure that you can use title as selector. Especially if you clone an already initialized instance.

Note: the only sure is that can be reverted just letting title empty, but it is not a valid way to leave the attribute empty

I think this PR doesn't resolve https://github.com/twbs/bootstrap/issues/36813 (my issue). I setted up https://deploy-preview-36914--twbs-bootstrap.netlify.app/docs/5.2/dist/js/bootstrap.bundle.min.js without success.

Look at this code pen, it's exactly the code I use: https://codepen.io/BrokenSourceCode/pen/PoRBzKv.

screenshot

Rezyan avatar Aug 09 '22 17:08 Rezyan

Thank you for your test. I reverted the change of title attribute (f156f8c) to almost its initial state, just to avoid inconsistencies, but have in mind to replace this usage as it is invalid. We keep an empty attribute instead of removing it. 😞

GeoSot avatar Aug 10 '22 22:08 GeoSot

Thank you for your test. I reverted the change of title attribute (f156f8c) to almost its initial state, just to avoid inconsistencies, but have in mind to replace this usage as it is invalid. We keep an empty attribute instead of removing it. 😞

@GeoSot I have already planned to replace my code. You don't need to revert previous commits for the issue I encountered, not for me.

Rezyan avatar Aug 10 '22 23:08 Rezyan

@julien-deramond what is your opinion? May I drop 5cc297d1767cfa9a0d6e27f9804c354392e96dc6 or not?

GeoSot avatar Sep 01 '22 07:09 GeoSot

@julien-deramond what is your opinion? May I drop 5cc297d or not?

IMHO setting the title to an empty string is not a good practice and can lead to bad usage. Since the first commit fixes the 2 issues, I'd drop https://github.com/twbs/bootstrap/commit/5cc297d1767cfa9a0d6e27f9804c354392e96dc6.

julien-deramond avatar Sep 07 '22 07:09 julien-deramond