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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user