Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ConditionalDisplayers/Client/src/sharedLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const toggleElements = (aliases: string, isShow: boolean, hostElement: HT
: el) ?? el;

if (isShow) {
const wasHidden = target.style.display === 'none';
target.style.removeProperty('display');
if (wasHidden) {
refreshAutoHeightTextareas(target);
}
} else {
target.style.display = 'none';
}
Expand All @@ -40,6 +44,18 @@ export const toggleElements = (aliases: string, isShow: boolean, hostElement: HT
}
}

/**
* uui-textarea measures its auto height when connected. If that happens while hidden (display: none)
* it collapses to ~2px and never recovers, so re-measure once the element is visible again.
*/
const refreshAutoHeightTextareas = (container: HTMLElement) => {
requestAnimationFrame(() => {
deepQuerySelectAll('uui-textarea[auto-height]', container, false).forEach((textarea) => {
(textarea as HTMLElement & { autoUpdateHeight?: () => void }).autoUpdateHeight?.();
});
});
}

const elSelectors = (aliasList: string[]): string => {
let cssSelector = "";

Expand Down