Skip to content

A platform for community discussion. Free, open, simple.

FIX: Avoid unpinning composer on iOS when invoking emojis

Penar Musaraj68124caae266
diff --git a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6
index 9241cbbed7b..799d3c904c2 100644
--- a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6
+++ b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6
@@ -116,12 +116,16 @@ function positioningWorkaround($fixedElement) {
// - switching to another iOS app
// - invoking a select-kit dropdown
// - invoking mentions
+ // - invoking emoji dropdown via : and hitting return
// - invoking a toolbar button
+
if (
lastTouchedElement &&
(document.visibilityState === "hidden" ||
$(lastTouchedElement).hasClass("select-kit-header") ||
$(lastTouchedElement).closest(".autocomplete").length ||
+ (lastTouchedElement.nodeName.toLowerCase() === "textarea" &&
+ document.activeElement === lastTouchedElement) ||
["span", "svg", "button"].includes(
lastTouchedElement.nodeName.toLowerCase()
))