Chat plugin doesn't understand tab focus

Basically, the chat plugin doesn’t factor in whether the browser tab is currently focused/active.

Impact

Lost notifications and missing unread count in title bar.

Repro steps

Tested in firefox on latest 3.5.0.beta2-dev

  1. User A + B is logged into discourse and DMing each other using chat plugin.
  2. User A has the chat open, but in another tab.
  3. User B sends message to user A.
  4. User A’s tab briefly shows “(1)” to show the new message but quickly hides it one second later.
  5. User A does not receive a desktop notification.

Note: If User A does not have the chat window open but is otherwise still on discourse, the (1) in titlebar remains correctly and a system notification is displayed.

Expected behavior

If the tab isn’t visible/focused (whether that’s because it’s tab #29 or buried behind several other windows), as a user I want to receive notification.


Thank you!

2 Likes

Hi, thanks for the report.

I have a few questions that will help with debugging.

  • In this situation, is Discourse open in the tab that has focus (without chat open)?

  • Are you using full screen chat or drawer mode?

Is the desktop notification in this case the green badge on the chat icon? Or something else?

1 Like

No problem:

For User A, the browser’s focused tab is something else (ex: google). Inside the discourse tab, which is not browser focused, the chat is open.

I am 90% sure I saw this in both scenarios, but I’ll have to go back and re-test to know for sure which one (replying now so I can share the other info at least right away)

Desktop notification is the push notification that comes through the OS.

1 Like

Update, I confirmed that it occurs in both the full screen and drawer mode.

The behavior is also different in chrome – it shows a (3) that then goes down to (2).

Also in both browsers, it sometimes just doesn’t go through for 30 seconds (until the next poll request according to network debugger). But maybe that part is just an internet connection problem

I took a video demonstrating the problem, attached:

  • 0:08 Firefox receive issue
  • 0:32 Chrome receive issue
  • 0:50 Slow update issue