EDIT: A prototype is available: RFC: Better chat @mentions – A prototype
Status: 50% - Solution is proposed, nothing's implemented yet.
Pinging (@mentioning) users in chat is problematic.
- It is possible to accidentally ping several users at once. In some cases, this cannot even be prevented at all.
- There is a possibility to shortcut @mentions (not spelling out the full username), but the exact rules for this aren't obvious, and using this shortcut increases ambiguity and thus the chance for pinging more than the intended recipient. In some cases it's even possible to ping only a wrong user, but not the one you actually meant to ping.
Usernames on the Stack Exchange sites are not unique. Unlike on many other sites, users can (and will) select any display name, regardless of whether somebody else is already using the same name. This is nice (I think), but it comes with the problem that when you're using the display name to specify a user, it may not be unambiguous.
The concept of specifying a user via their display name first appeared when comment mentions were introduced. The rules for how this works, which are largely unchanged, are okay for comments, where the number of involved people in a comment thread is usually very low.
When chat was created we mostly adopted the same notification rules; after all, that's what users are familiar with. However, chat rooms are much busier than comment threads, and thus it's much more likely that there are users with overlapping names.
We went through several iterations until we ended up with the current set of precise rules for matching (listed here; for company-internal chat, the rules are slightly different), which are a compromise between minimizing the amount of false positives (pinging users that you didn't mean to ping) and false negatives (not being able to ping the user you'd like to be notified of your message).
Chat has an autocomplete functionality that allows you to start typing a @username and then use Tab or click to select the user, which will put the complete display name of the user (in its mentionable form, i.e. with spaces removed) into your message. For a long time, the list of users that the autocompleter offered was rather arbitrary. It was guaranteed to know all users that are currently in the room, but beyond that, all bets were off. If the autocompleter listed a user, there was no guarantee that the user was actually notified of your ping, and if it was possible to ping a user by @mentioning them, there was no guarantee that they would appear in the autocompleter.
I fixed this about a year ago, which was a huge improvment, but it doesn't solve everything. If there is a user called "Leia" in the room and a user called "Leia Skywalker", then it's still impossible to ping the former without also pinging the latter, even if you explicitly chose "Leia" in the autocompleter.
In addition, you don't have to use the autocompleter; you can just type the @mention by hand. And you don't have to type the full name. It's not uncommon for people to not use the autocompleter, and to also shortcut by just typing the partial name. The problem this causes is that when there's a user "Darth Vader" in the room and a user "Darth Sidious", and you notify the former by just typing "@Darth", it'll also ping the latter. And that's even though in this case, it would actually be possible to uniquely notify the single user. This is a particular problem for users who use their real name as their display name and have a common first name. Just ask Nick Larsen how often he gets pinged by someone who was talking to Nick Craver but only typed "@Nick".
Here's what I'm thinking about doing.
It is no longer possible to mention users just by having (part of) their @username appear in the chat message. You must use the autocompleter to explicitly and unambiguously choose the user to ping. As a shortcut, if the autocompleter only shows a single matching user, pressing space (or maybe some punctuation) will automatically choose that user without you having to click or Tab.
The mention will still appear as "@username", but the visuals of the chat input box will make it obvious that this is more than just a piece of text. I'm imagining something along the lines of this:
Behind the scenes, there'll probably still be a textual representation (something like
@ where 1234 is the user id) but it wouldn't be displayed that way.
While beyond the scope of this post, in the long run the rendered chat message could also highlight a mention in a similar way.
- Is this a good idea at all? Why/why not?
- Should there be a transitioning phase during which the old @plaintext mention still works, maybe with something like a deprecation warning?
- [this question is irrelevant for company-internal chat] With this change, it would be theoretically feasible to allow pinging any chat user, regardless of whether they have ever interacted with the room in question. Is that something we'd want? Or should there still be restrictions similar to today's 7-day rule?
- Anything else?
(If you're wondering about the structure of this question, this is how RFCs (Requests For Comments) look, which is how we solicit feedback on ideas inside Stack Exchange the company. These RFCs are usually private Google docs, but I'm making this a combined RFC/Meta question, because the proposed change impacts both the public chat and our company-internal chat, as they both use the same platform.)