feat: Allow disabling auto-scroll using ui.disable-auto-scroll (#23462)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2025-09-01 14:21:30 +00:00
1 parent 712467a7f4
commit 6b0726bcde
4 files changed
+14 -2

No files matched your search

@@ -579,10 +579,13 @@ function main() {
const url = new URL(document.URL);
embedStore.theme = window?.getEmbedTheme?.();
const autoScrollFromParam = url.searchParams.get("ui.autoscroll");
const shouldDisableAutoScroll = autoScrollFromParam === "false";
embedStore.uiConfig = {
// TODO: Add theme as well here
colorScheme: url.searchParams.get("ui.color-scheme"),
layout: url.searchParams.get("layout") as BookerLayouts,
disableAutoScroll: shouldDisableAutoScroll,
};
actOnColorScheme(embedStore.uiConfig.colorScheme);
@@ -79,6 +79,7 @@ function listKnownConfigProps() {
"ui.color-scheme",
"theme",
"cal.embed.pageType",
"ui.autoscroll",
];
return knownConfigProps;
}
+2
View File
@@ -32,6 +32,7 @@ export type UiConfig = {
cssVarsPerTheme?: Record<Theme, Record<string, string>>;
layout?: BookerLayouts;
colorScheme?: string | null;
disableAutoScroll?: boolean;
};
declare global {
@@ -63,6 +64,7 @@ export type KnownConfig = {
layout?: BookerLayouts;
// TODO: Rename layout and theme as ui.layout and ui.theme as it makes it clear that these two can be configured using `ui` instruction as well any time.
"ui.color-scheme"?: string;
"ui.autoscroll"?: "true" | "false";
theme?: EmbedThemeConfig;
// Prefixing with cal.embed because there could be more query params that aren't required by embed and are used for things like prefilling booking form, configuring dry run, and some other params simply to be forwarded to the booking success redirect URL.
// There are some cal. prefixed query params as well, not meant for embed specifically, but in general for cal.com