Page Title changes when focus changes; Pinned tab blinks constantly

(Claus Strasburger) #1

I often have a Discourse instance open as a pinned tab (AKA application tab), to save some precious pixels. My browser (Chrome 31) rewards this with blinking the tab whenever something’s new.
The problem: This event fires way too often, even if nothing changes. In particular, it fires if I switch to another tab. So my tab is left blinking constantly.

I found out Chrome does this whenever the page title changes. After some more searching, I found the page title is updated in Discourse every time the focus changes!
(see observes(..."hasFocus"...))

Two questions:

  • Is it really necessary to observe that property?
  • If yes, can we add a check to only change the title property if it’s different from the last one?

(Claus Strasburger) #2

Two proposed fixes:

(Bill Ayakatubby) #3

Thanks for investigating this. I’ve noticed the same thing in Chrome 31 on Win 8.1 desktop mode.

(Sam Saffron) #4

The reason why we muck with the title on focus is cause we add (*) in front. But I totally agree we should not be messing with an otherwise good title.

Does this work for you?

I know this drives @geek mad as well.

(Lowell Heddings) #5

Seems to be working for me now. Much better!

(Claus Strasburger) #6

Yes, thank you! (silly me for forgetting there already exists a property with the old title in the DOM :smile: )

(Bill Ayakatubby) #9

I flagged this for re-open because I’m still seeing my pinned tabs blink whenever I focus another tab. This happens on both meta and try with Chrome 32 on Win8.1 desktop mode. I can try taking another crappy cell phone video if you like. :slight_smile:

(Jeff Atwood) #10

Still an issue? Would like to close this.

(Bill Ayakatubby) #11

Yes, still an issue.

(James Finstrom) #12

still an issue here Chrome Version 34.0.1847.132

(Sam Saffron) #13

Can someone try this on meta again, I think I may have fixed it with my latest round of changes.

cc @BhaelOchon @cfstras

(Claus Strasburger) #14

Sorry, still happens. You can test it with this snippet:

document.documentElement.addEventListener("DOMSubtreeModified", function(evt) {
  var t =;
  var titleEl = $("title")[0];
  if (t === titleEl || (t.parentNode && t.parentNode === titleEl)) {
    console.log(new Date(), document.title);
}, false);

When changing away from the tab, the title changes to "" and back again, which probably causes the blinking.

(Bill Ayakatubby) #15

Confirmed, still happens for me too.

(Sam Saffron) #16

Can you try again?



(Bill Ayakatubby) #17

It’s still happening on try.d and meta.d after hard refreshes. According to @cfstras’s snippet, when switching tabs, <title/> is still set to "" before being set back. It also happens when navigating between pages/topics.

(Sam Saffron) #18

Not deployed here yet :slight_smile:

(Kane York) #19

Can confirm that the above commit fixes it on .

(Sam Saffron) #20

This topic was automatically closed after 3 hours. New replies are no longer allowed.