Oh I get it, this fixes it:
diff --git a/frontend/discourse/app/modifiers/d-autocomplete.js b/frontend/discourse/app/modifiers/d-autocomplete.js
index e49fc0ec53..33fb51a1f4 100644
--- a/frontend/discourse/app/modifiers/d-autocomplete.js
+++ b/frontend/discourse/app/modifiers/d-autocomplete.js
@@ -599,10 +599,19 @@ export default class DAutocompleteModifier extends Modifier {
prev = this.getValue()[caretPos - 1];
const shouldTrigger = await this.shouldTrigger({ backSpace });
- if (
- shouldTrigger &&
- (prev === undefined || this.ALLOWED_LETTERS_REGEXP.test(prev))
- ) {
+ // For emoji autocomplete (key === ':'), use a more permissive check that includes
+ // common punctuation like comma, period, etc. that can appear before emoji
+ let isAllowed;
+ if (this.options.key === ":") {
+ // Match the same characters allowed in emoji autocomplete's onKeyUp regex
+ isAllowed =
+ prev === undefined || /[\s.?,@/#!%&*;:\[\]{}=\-_()+]/.test(prev);
+ } else {
+ isAllowed =
+ prev === undefined || this.ALLOWED_LETTERS_REGEXP.test(prev);
+ }
+
+ if (shouldTrigger && isAllowed) {
start = caretPos;
term = this.getValue().substring(caretPos + 1, initialCaretPos);
end = caretPos + term.length;
@kelv I am not super familiar with how this code evolved, perhaps some of this rings a bell with some of the porting you did recently?