Skip to content

Commit 1750557

Browse files
authored
fix: Re-enable scroll lock (#3003)
Fixes stickied elements disappearing from viewport when dialogs or drawers are open due to hacky fix for QA dialogs.
1 parent 0119ae9 commit 1750557

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

frontend/src/pages/org/archived-item-qa/archived-item-qa.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,18 @@ export class ArchivedItemQA extends BtrixElement {
338338
}
339339
}
340340

341+
protected updated(changedProperties: PropertyValues): void {
342+
if (
343+
changedProperties.has("crawlData") &&
344+
this.crawlData?.replayUrl &&
345+
this.crawlData.replayUrl !==
346+
(changedProperties.get("crawlData") as QATypes.ReplayData | undefined)
347+
?.replayUrl
348+
) {
349+
this.showReplayPageLoadingDialog();
350+
}
351+
}
352+
341353
private async initItem() {
342354
void this.fetchCrawl();
343355
await this.fetchQARuns();
@@ -1038,6 +1050,8 @@ export class ArchivedItemQA extends BtrixElement {
10381050
return html`
10391051
<div
10401052
class="replayContainer ${tw`h-full min-h-96 [contain:paint] lg:min-h-0`}"
1053+
@sl-show=${this.disableScrollLock}
1054+
@sl-after-hide=${this.enableScrollLock}
10411055
>
10421056
<div
10431057
class=${tw`relative h-full overflow-hidden rounded-b-lg border-x border-b bg-slate-100 p-4 shadow-inner`}
@@ -1111,7 +1125,6 @@ export class ArchivedItemQA extends BtrixElement {
11111125
</div>
11121126
<btrix-dialog
11131127
class="loadingPageDialog"
1114-
?open=${this.tab === "replay"}
11151128
no-header
11161129
@sl-request-close=${(e: SlRequestCloseEvent) => e.preventDefault()}
11171130
>
@@ -1131,6 +1144,16 @@ export class ArchivedItemQA extends BtrixElement {
11311144
`;
11321145
}
11331146

1147+
private readonly disableScrollLock = (e: CustomEvent) => {
1148+
e.stopPropagation();
1149+
document.documentElement.classList.add("disable-scroll-lock");
1150+
};
1151+
1152+
private readonly enableScrollLock = (e: CustomEvent) => {
1153+
e.stopPropagation();
1154+
document.documentElement.classList.remove("disable-scroll-lock");
1155+
};
1156+
11341157
private readonly renderRWP = (rwpId: string, { qa }: { qa: boolean }) => {
11351158
if (!rwpId) return;
11361159

frontend/src/theme.stylesheet.css

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@
500500
height: var(--btrix-overflow-scrim-width);
501501
--tw-gradient-from: var(--btrix-overflow-scroll-scrim-color, white);
502502
}
503+
504+
.sl-scroll-lock.disable-scroll-lock body {
505+
overflow: auto !important;
506+
}
503507
}
504508

505509
/* Following styles won't work with layers */
@@ -514,17 +518,3 @@
514518
[class*=" hover\:text-"]::part(base):hover {
515519
color: inherit;
516520
}
517-
518-
/* Fix scrollbar gutter not actually */
519-
html {
520-
overflow: auto;
521-
scrollbar-gutter: stable;
522-
}
523-
524-
body.sl-scroll-lock {
525-
scrollbar-gutter: auto !important;
526-
}
527-
/* Leave document scrollable now for replay.ts embedded dialogs */
528-
/* html:has(body.sl-scroll-lock) {
529-
overflow: hidden;
530-
} */

0 commit comments

Comments
 (0)