Fix expand/collapse reply preview not showing in some cases (#31639)

* Fix expand/collapse reply preview not showing in some cases

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Move tests to appropriate place

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add comments

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2026-01-06 11:57:23 +00:00
committed by GitHub
parent c078a596f9
commit ddad82075a
4 changed files with 162 additions and 68 deletions
+7 -1
View File
@@ -106,7 +106,13 @@ export default class ReplyChain extends React.Component<IProps, IState> {
if (el) {
const code: HTMLElement | null = el.querySelector("code");
const isCodeEllipsisShown = code ? code.offsetHeight >= SHOW_EXPAND_QUOTE_PIXELS : false;
const isElipsisShown = el.offsetHeight >= SHOW_EXPAND_QUOTE_PIXELS || isCodeEllipsisShown;
const isElipsisShown =
isCodeEllipsisShown ||
el.offsetHeight >= SHOW_EXPAND_QUOTE_PIXELS ||
// Check whether the body fits into it's scroll container
el.clientHeight !== el.scrollHeight ||
// Do the same for its children as the scroll container may be on them instead
[...el.children].some((child) => child.clientHeight !== child.scrollHeight);
if (isElipsisShown) {
this.props.setQuoteExpanded(false);
}