Page MenuHomePhabricator

@ shortcut for opening mention inspector
Closed, ResolvedPublic

Event Timeline

Change 198182 had a related patch set uploaded (by Mattflaschen):
Add @ as a keyboard shortcut to open mentions.

https://gerrit.wikimedia.org/r/198182

That doesn't do anything of the possibilities we discussed (e.g. different behavior directly after a letter).

For now at least, it's just a keyboard shortcut, which means the implementation is simple. But if you want to use the actual character, you need to paste it in.

This is separate from the main commit, so it doesn't block the overall feature.

I think you'll want a sequence registry on ' @', like is done for '[[' in

VisualEditor/modules/ve-mw/ui/ve.ui.MWSequenceRegistry.js

@ makes sense to me. It's also what Phab uses.

I think you'll want a sequence registry on ' @', like is done for '[[' in

VisualEditor/modules/ve-mw/ui/ve.ui.MWSequenceRegistry.js

Technically, unlike all of those (except apparently wikitextDefinition and wikitextDescription), it's not a sequence.

But in terms of actual behavior, what are the differences? Is it just that it catches all ways it can be typed (not just Shift-2) (that would probably good in and of itself, but I'm wondering what the other effects are)?

As far as I understand:

  • a sequence looks at what text was last entered into the 'textarea' (and then removes the match and executes a command instead). So this would be ideal for this situation I think, @ is better than 'shift-2'.
  • a trigger watches what keys are being pressed

And my 2nd idea was that we could look for '<spacechar>@' instead of just '@' to avoid triggering the mention dialog in situations a bit too often.

  • a sequence looks at what text was last entered into the 'textarea' (and then removes the match and executes a command instead). So this would be ideal for this situation I think, @ is better than 'shift-2'.

Thanks, makes sense.

  • a trigger watches what keys are being pressed

And my 2nd idea was that we could look for '<spacechar>@' instead of just '@' to avoid triggering the mention dialog in situations a bit too often.

Yeah, I was thinking we could do this if @ becomes a problem

Yeah, I was thinking we could do this if @ becomes a problem

Requiring a space before the "@" may be problematic in the specific case of starting your text with a mention, which is a common pattern when specifically replying to someone on many discussion systems. So I would generalise the approach to be "<space-or-line-start>@". In any case, I agree with starting simple since I expect mentions to be the main usecase for writing @ in conversations (with few exceptions ).

Keeping the "@" character in the text if I close the mention panel (when triggered by typing "@") would make sure it is possible to add the character to the content for the cases it may be needed.

Yeah, I was thinking we could do this if @ becomes a problem

Requiring a space before the "@" may be problematic in the specific case of starting your text with a mention, which is a common pattern when specifically replying to someone on many discussion systems.

Actually, I was more thinking '@ ' (@<spacechar>). I should have read @TheDJ's suggestion more closely. Both ordered (# ) and unordered (* ) work like this in VE.

Keeping the "@" character in the text if I close the mention panel (when triggered by typing "@") would make sure it is possible to add the character to the content for the cases it may be needed.

Filed as T94216: Preserve @ sign if user closes mention inspector empty.

Change 198182 merged by jenkins-bot:
Add @ as a sequence to open mentions.

https://gerrit.wikimedia.org/r/198182