Partial fix Spoiler Tooltip Appears When Spoiler Is Open And Browser Tabs Are Switched


Well-known member
As the title says, spoiler tooltip remains visible ("Click to reveal or hide spoilers") in Chrome (tested in chrome) when a spoiler is open and you visit another tab and return to the original tab.

Steps to reproduce:
  • Visit this testing thread -
  • Open spoiler tag and do not click on any other part of the page. Keep the spoiler tab open.
  • Click on a open tab/open a new tab in the browser.
  • Return back to testing thread tab, you will see the tooltip visible.
  • Click on any part of the page to remove the tooltip.


Well-known member
I wouldn't think so. Why, if none of the other tooltips work that way, would you think that one is as designed?
Indeed, that is why I reported this as a bug since this isn't a normal behavior with the other tooltips and it felt odd.


XenForo moderator
Staff member
The reason is the button stays focussed after clicking it.
So I guess it needs to have the focus removed.


XenForo developer
Staff member
This can possibly happen elsewhere. What happens is that clicking the button focuses it. When you click to another tab, blur is fired (which would hide the tooltip); when you come back, the browser fires focus again. That necessitates showing the tooltip again -- this is the correct behavior for focus being fired. (It's important to allow tooltips to work with keyboard navigation.)

So the only option is really to prevent the focus. We don't want to do that generally because it will destroy keyboard navigation with the spoilers. So I'm just immediately calling blur when the spoiler button is clicked with a mouse (or mouse-like thing). Of course, this hides the tooltip when clicking, but there isn't really a generic way around that.