Skip to content

Commit

Permalink
Fix docs error after #35644
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Mar 11, 2022
1 parent d21a51a commit bb38259
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions site/assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,17 @@

/**
*
* @param {HTMLButtonElement} btn
* @param {string} selector
* @param {string} title
*/
function snippetButtonTooltip(btn, title) {
var tooltipBtn = new bootstrap.Tooltip(btn, { title: title })

btn.addEventListener('mouseleave', function () {
// Explicitly hide tooltip, since after clicking it remains
// focused (as it's a button), so tooltip would otherwise
// remain visible until focus is moved away
tooltipBtn.hide()
function snippetButtonTooltip(selector, title) {
document.querySelectorAll(selector).forEach(function (btn) {
new bootstrap.Tooltip(btn, { title: title })
})
}

snippetButtonTooltip(document.querySelector('.btn-clipboard'), 'Copy to clipboard')
snippetButtonTooltip(document.querySelector('.btn-edit'), 'Edit on Stackblitz')
snippetButtonTooltip('.btn-clipboard', 'Copy to clipboard')
snippetButtonTooltip('.btn-edit', 'Edit on Stackblitz')

var clipboard = new ClipboardJS('.btn-clipboard', {
target: function (trigger) {
Expand Down

0 comments on commit bb38259

Please sign in to comment.