This is now implemented. The sound and the desktop notification will originate from a browser tab that shows the corresponding room, if there is such a one. If there's not, then it falls back to the chat browser tab that most recently had focus. I'm still not sure whether that should also switch to the correct room, or what other behavior there should be. But if you have a tab with the room open, that's where clicking the desktop notification will take you.
I've considered this (and haven't discarded the idea), but it's a fairly involved change. Currently, the notifications (and the sound) originate from the browser tab that has been designated the "master", which to the user is a rather arbitrary one (in fact, it'll be the one that's been open the longest).
Since we can only cause a click on the notification to surface the tab that created the notification, not a different one (that's a browser security feature that we can't do anything about), we would have to make some infrastructure changes to support this. It's not impossible and I agree it would be nice, it's just not simple.
One other question that would have to be answered is: What if the notification is from a room that's not the active room in any currently active tab?
- In that case, open an "arbitrary" tab again?
- Or open a new tab that shows the corresponding rooms? (This may cause issues with popup blockers)
Or open an "arbitrary" tab, but switch it to the room that caused the notification?
And what if the notification came from a room that you're not currently in? In that case, we don't currently show a desktop notification at all (only a "You have been mentioned in a room you're not currently in" notification bar in the chat browser tab).