Skip to content

Commit

Permalink
code review e7294a4: force refresh tooltip if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 7, 2017
1 parent e7294a4 commit 9884ff1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ var renderPopup = function() {
// https://github.com/gorhill/uBlock/issues/2889
// Use tooltip for ARIA purpose.

var renderTooltips = function() {
var renderTooltips = function(selector) {
var elem = uDom.nodeFromId('switch'),
off = document.body.classList.contains('off'),
text;
Expand All @@ -518,6 +518,10 @@ var renderTooltips = function() {
elem.setAttribute('aria-label', text);
elem.setAttribute('data-tip', text);
}
if ( typeof selector === 'string' ) {
uDom.nodeFromId('tooltip').textContent =
uDom.nodeFromSelector(selector).getAttribute('data-tip');
}
};

/******************************************************************************/
Expand Down Expand Up @@ -621,7 +625,7 @@ var toggleNetFilteringSwitch = function(ev) {
tabId: popupData.tabId
}
);
renderTooltips();
renderTooltips('#switch');
hashFromPopupData();
};

Expand Down

0 comments on commit 9884ff1

Please sign in to comment.