diff --git a/intl/unicharutil/util/nsUnicodeProperties.cpp b/intl/unicharutil/util/nsUnicodeProperties.cpp
index 7f5029765cc417dd262562d631c74446d767d7e4..ea7fa80ea92b82dda07d3a713bc8409d9631312d 100644
--- a/intl/unicharutil/util/nsUnicodeProperties.cpp
+++ b/intl/unicharutil/util/nsUnicodeProperties.cpp
@@ -167,6 +167,15 @@ bool IsClusterExtender(uint32_t aCh, uint8_t aCategory) {
       (aCh >= 0xe0020 && aCh <= 0xe007f));   // emoji (flag) tag characters
 }
 
+bool IsClusterExtenderExcludingJoiners(uint32_t aCh, uint8_t aCategory) {
+  return (
+      (aCategory >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK &&
+       aCategory <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) ||
+      (aCh >= 0xff9e && aCh <= 0xff9f) ||    // katakana sound marks
+      (aCh >= 0x1F3FB && aCh <= 0x1F3FF) ||  // fitzpatrick skin tone modifiers
+      (aCh >= 0xe0020 && aCh <= 0xe007f));   // emoji (flag) tag characters
+}
+
 uint32_t CountGraphemeClusters(Span<const char16_t> aText) {
   intl::GraphemeClusterBreakIteratorUtf16 iter(aText);
   uint32_t result = 0;
diff --git a/intl/unicharutil/util/nsUnicodeProperties.h b/intl/unicharutil/util/nsUnicodeProperties.h
index 610dc3c734d27607b64e895b8a38704d1f410756..6f3c9dbaf89367e7205a1450add784910012a5a4 100644
--- a/intl/unicharutil/util/nsUnicodeProperties.h
+++ b/intl/unicharutil/util/nsUnicodeProperties.h
@@ -159,6 +159,12 @@ inline bool IsClusterExtender(uint32_t aCh) {
   return IsClusterExtender(aCh, GetGeneralCategory(aCh));
 }
 
+bool IsClusterExtenderExcludingJoiners(uint32_t aCh, uint8_t aCategory);
+
+inline bool IsClusterExtenderExcludingJoiners(uint32_t aCh) {
+  return IsClusterExtenderExcludingJoiners(aCh, GetGeneralCategory(aCh));
+}
+
 // Count the number of grapheme clusters in the given string
 uint32_t CountGraphemeClusters(Span<const char16_t> aText);
 
diff --git a/layout/generic/nsTextFrameUtils.cpp b/layout/generic/nsTextFrameUtils.cpp
index 170ee0f7e6179ffc7a46f0765f53397c82cefbea..1cfa51fbdecf57e1d37984ee1921b18b4d288505 100644
--- a/layout/generic/nsTextFrameUtils.cpp
+++ b/layout/generic/nsTextFrameUtils.cpp
@@ -23,7 +23,7 @@ using namespace mozilla::dom;
 bool nsTextFrameUtils::IsSpaceCombiningSequenceTail(const char16_t* aChars,
                                                     int32_t aLength) {
   return aLength > 0 &&
-         (mozilla::unicode::IsClusterExtender(aChars[0]) ||
+         (mozilla::unicode::IsClusterExtenderExcludingJoiners(aChars[0]) ||
           (IsBidiControl(aChars[0]) &&
            IsSpaceCombiningSequenceTail(aChars + 1, aLength - 1)));
 }