diff --git a/fern/asset-source/css/03-support-launcher.css b/fern/asset-source/css/03-support-launcher.css
index c5f9ffa2..ca208896 100644
--- a/fern/asset-source/css/03-support-launcher.css
+++ b/fern/asset-source/css/03-support-launcher.css
@@ -8,7 +8,3 @@
.sixmm-support-status[data-state="error"] .sixmm-support-spinner { display:none; }
@keyframes sixmm-support-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .sixmm-support-spinner { animation:none; } }
-
-.sixmm-support-launcher { position:fixed; z-index:999997; right:calc(24px + env(safe-area-inset-right, 0px)); bottom:calc(24px + env(safe-area-inset-bottom, 0px)); width:48px; height:48px; display:grid; place-items:center; border:0; border-radius:15px; background:var(--sixmm-accent); color:white; cursor:pointer; box-shadow:0 2px 8px #0002; }
-.sixmm-support-launcher:focus-visible { outline:3px solid var(--sixmm-accent-strong); outline-offset:4px; }
-.sixmm-support-launcher[aria-busy="true"] { opacity:.65; cursor:wait; }
diff --git a/fern/asset-source/css/07-support-loading.css b/fern/asset-source/css/07-support-loading.css
deleted file mode 100644
index a08701b1..00000000
--- a/fern/asset-source/css/07-support-loading.css
+++ /dev/null
@@ -1,15 +0,0 @@
-html.sixmm-support-widget-loading body::after {
- position: fixed;
- z-index: 999997;
- right: calc(24px + env(safe-area-inset-right, 0px));
- bottom: calc(24px + env(safe-area-inset-bottom, 0px));
- width: 48px;
- height: 48px;
- border-radius: 15px;
- background-color: var(--sixmm-accent);
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 14v-3a9 9 0 0 1 18 0v3'/%3E%3Crect x='1' y='13' width='4' height='7' rx='2' fill='white'/%3E%3Crect x='19' y='13' width='4' height='7' rx='2' fill='white'/%3E%3Cpath d='M21 18v1a3 3 0 0 1-3 3h-4'/%3E%3C/svg%3E");
- background-position: center;
- background-repeat: no-repeat;
- content: "";
- pointer-events: none;
-}
diff --git a/fern/asset-source/support/01-state.js b/fern/asset-source/support/01-state.js
index 465ba17b..ecae4cfc 100644
--- a/fern/asset-source/support/01-state.js
+++ b/fern/asset-source/support/01-state.js
@@ -28,8 +28,6 @@ var observedWidgetContainer = null;
var widgetContainerObserver = null;
var observedWidgetBody = null;
var widgetBodyObserver = null;
-var widgetRequested = false;
-var openWhenReady = false;
var retainedModalStyles = null;
var supportFrame = null;
var supportStatus = null;
diff --git a/fern/asset-source/support/02-status-and-accessibility.js b/fern/asset-source/support/02-status-and-accessibility.js
index 51467a91..6e322398 100644
--- a/fern/asset-source/support/02-status-and-accessibility.js
+++ b/fern/asset-source/support/02-status-and-accessibility.js
@@ -211,8 +211,6 @@ function setAttributeIfChanged(element, name, value) {
function syncWidgetAccessibility() {
var bubble = document.getElementById('cs-widget-bubble');
var container = document.getElementById('cs-widget-container');
- var launcher = document.getElementById('sixmm-support-launcher');
- if (launcher) setAttributeIfChanged(launcher, 'aria-label', supportLabels[currentDocsLocale() || 'en'] || supportLabels.en);
if (!bubble || !container) {
if (widgetContainerObserver) widgetContainerObserver.disconnect();
observedWidgetContainer = null;
@@ -220,11 +218,6 @@ function syncWidgetAccessibility() {
}
var frame = container.querySelector('iframe');
if (frame) ensureSupportStatus(container, frame);
- if (launcher) launcher.remove();
- if (openWhenReady && window.CSWidget && typeof window.CSWidget.open === 'function') {
- openWhenReady = false;
- window.CSWidget.open();
- }
var open = container.style.display !== 'none';
var label = supportLabels[currentDocsLocale() || 'en'] || supportLabels.en;
setAttributeIfChanged(bubble, 'role', 'button');
diff --git a/fern/asset-source/support/03-navigation-persistence.js b/fern/asset-source/support/03-navigation-persistence.js
index 7bb23fc5..674fa69e 100644
--- a/fern/asset-source/support/03-navigation-persistence.js
+++ b/fern/asset-source/support/03-navigation-persistence.js
@@ -20,7 +20,6 @@ function prepareWidgetSwap(event) {
document.getElementById('cs-bubble-style'),
document.querySelector('script[data-sixmm-support-widget="true"]'),
document.getElementById('cs-widget-overlay'),
- document.getElementById('sixmm-support-launcher'),
document.getElementById('cs-widget-greeting'),
document.getElementById('cs-widget-image-preview'),
];
@@ -68,13 +67,12 @@ function restoreWidgetAfterSwap() {
});
retainedModalStyles = null;
}
- if (widgetRequested) loadWidget();
- else ensureLauncher();
+ loadWidget();
syncWidgetAccessibility();
if (pendingWidgetDocsLocale !== null) {
confirmPendingWidgetDocsNavigation();
} else {
- if (widgetRequested) syncWidgetLanguageFromHost(20, false);
+ syncWidgetLanguageFromHost(20, false);
}
- if (widgetRequested) syncWidgetThemeFromHost(20, false);
+ syncWidgetThemeFromHost(20, false);
}
diff --git a/fern/asset-source/support/05-sdk-loader.js b/fern/asset-source/support/05-sdk-loader.js
index fb488b53..4bd02047 100644
--- a/fern/asset-source/support/05-sdk-loader.js
+++ b/fern/asset-source/support/05-sdk-loader.js
@@ -1,8 +1,5 @@
function loadWidget() {
- if (document.querySelector('script[data-sixmm-support-widget="true"]')) {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
- return;
- }
+ if (document.querySelector('script[data-sixmm-support-widget="true"]')) return;
var initialLang = currentLang();
var initialTheme = currentTheme();
@@ -18,46 +15,19 @@ function loadWidget() {
script.dataset.color = currentAccentColor();
script.dataset.appKey = APP_KEY;
script.onload = function () {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
// The host may have changed while widget.js was loading.
syncWidgetLanguageFromHost(20, true);
syncWidgetThemeFromHost(20, true);
syncWidgetAccessibility();
};
script.onerror = function () {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
script.remove();
- widgetRequested = false;
- openWhenReady = false;
- ensureLauncher();
};
lastTheme = initialTheme;
document.body.appendChild(script);
}
-function ensureLauncher() {
- if (document.getElementById('cs-widget-bubble')) return;
- var launcher = document.getElementById('sixmm-support-launcher');
- if (!launcher) {
- launcher = document.createElement('button');
- launcher.id = 'sixmm-support-launcher';
- launcher.type = 'button';
- launcher.className = 'sixmm-support-launcher';
- launcher.innerHTML = '';
- launcher.addEventListener('click', function () {
- widgetRequested = true;
- openWhenReady = true;
- launcher.setAttribute('aria-busy', 'true');
- loadWidget();
- });
- document.body.appendChild(launcher);
- }
- launcher.setAttribute('aria-busy', widgetRequested ? 'true' : 'false');
- syncWidgetAccessibility();
-}
-
function syncHostNavigation() {
- if (!widgetRequested) { syncWidgetAccessibility(); return; }
if (pendingWidgetDocsLocale !== null) { confirmPendingWidgetDocsNavigation(); return; }
syncWidgetLanguageFromHost(20, false);
}
@@ -69,18 +39,16 @@ function boot() {
document.addEventListener('astro:before-swap', prepareWidgetSwap);
document.addEventListener('astro:page-load', restoreWidgetAfterSwap);
- ensureLauncher();
window.addEventListener('popstate', syncHostNavigation);
window.addEventListener('pageshow', syncHostNavigation);
// The SDK mounts the controls asynchronously as direct body children.
observeWidgetBody();
// Initialize in the background on every fresh page load, so the iframe can
// mount before the user opens support. Astro navigation retains this SDK.
- widgetRequested = true;
loadWidget();
var observer = new MutationObserver(function () {
- if (widgetRequested) syncWidgetThemeFromHost(20, false);
+ syncWidgetThemeFromHost(20, false);
});
observer.observe(document.documentElement, {
attributes: true,
diff --git a/fern/styles.css b/fern/styles.css
index 2cca0854..5f8e6358 100644
--- a/fern/styles.css
+++ b/fern/styles.css
@@ -69,10 +69,6 @@
@keyframes sixmm-support-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .sixmm-support-spinner { animation:none; } }
-.sixmm-support-launcher { position:fixed; z-index:999997; right:calc(24px + env(safe-area-inset-right, 0px)); bottom:calc(24px + env(safe-area-inset-bottom, 0px)); width:48px; height:48px; display:grid; place-items:center; border:0; border-radius:15px; background:var(--sixmm-accent); color:white; cursor:pointer; box-shadow:0 2px 8px #0002; }
-.sixmm-support-launcher:focus-visible { outline:3px solid var(--sixmm-accent-strong); outline-offset:4px; }
-.sixmm-support-launcher[aria-busy="true"] { opacity:.65; cursor:wait; }
-
:root,
:root.dark {
accent-color: var(--sixmm-accent);
@@ -144,22 +140,6 @@ body::-webkit-scrollbar {
display: none;
}
-html.sixmm-support-widget-loading body::after {
- position: fixed;
- z-index: 999997;
- right: calc(24px + env(safe-area-inset-right, 0px));
- bottom: calc(24px + env(safe-area-inset-bottom, 0px));
- width: 48px;
- height: 48px;
- border-radius: 15px;
- background-color: var(--sixmm-accent);
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 14v-3a9 9 0 0 1 18 0v3'/%3E%3Crect x='1' y='13' width='4' height='7' rx='2' fill='white'/%3E%3Crect x='19' y='13' width='4' height='7' rx='2' fill='white'/%3E%3Cpath d='M21 18v1a3 3 0 0 1-3 3h-4'/%3E%3C/svg%3E");
- background-position: center;
- background-repeat: no-repeat;
- content: "";
- pointer-events: none;
-}
-
#fern-sidebar-scroll-area {
scrollbar-color: var(--sixmm-accent) transparent !important;
}
diff --git a/fern/support-widget.js b/fern/support-widget.js
index 5f6c3497..9ed891c4 100644
--- a/fern/support-widget.js
+++ b/fern/support-widget.js
@@ -33,8 +33,6 @@
var widgetContainerObserver = null;
var observedWidgetBody = null;
var widgetBodyObserver = null;
- var widgetRequested = false;
- var openWhenReady = false;
var retainedModalStyles = null;
var supportFrame = null;
var supportStatus = null;
@@ -259,8 +257,6 @@
function syncWidgetAccessibility() {
var bubble = document.getElementById('cs-widget-bubble');
var container = document.getElementById('cs-widget-container');
- var launcher = document.getElementById('sixmm-support-launcher');
- if (launcher) setAttributeIfChanged(launcher, 'aria-label', supportLabels[currentDocsLocale() || 'en'] || supportLabels.en);
if (!bubble || !container) {
if (widgetContainerObserver) widgetContainerObserver.disconnect();
observedWidgetContainer = null;
@@ -268,11 +264,6 @@
}
var frame = container.querySelector('iframe');
if (frame) ensureSupportStatus(container, frame);
- if (launcher) launcher.remove();
- if (openWhenReady && window.CSWidget && typeof window.CSWidget.open === 'function') {
- openWhenReady = false;
- window.CSWidget.open();
- }
var open = container.style.display !== 'none';
var label = supportLabels[currentDocsLocale() || 'en'] || supportLabels.en;
setAttributeIfChanged(bubble, 'role', 'button');
@@ -329,7 +320,6 @@
document.getElementById('cs-bubble-style'),
document.querySelector('script[data-sixmm-support-widget="true"]'),
document.getElementById('cs-widget-overlay'),
- document.getElementById('sixmm-support-launcher'),
document.getElementById('cs-widget-greeting'),
document.getElementById('cs-widget-image-preview'),
];
@@ -377,15 +367,14 @@
});
retainedModalStyles = null;
}
- if (widgetRequested) loadWidget();
- else ensureLauncher();
+ loadWidget();
syncWidgetAccessibility();
if (pendingWidgetDocsLocale !== null) {
confirmPendingWidgetDocsNavigation();
} else {
- if (widgetRequested) syncWidgetLanguageFromHost(20, false);
+ syncWidgetLanguageFromHost(20, false);
}
- if (widgetRequested) syncWidgetThemeFromHost(20, false);
+ syncWidgetThemeFromHost(20, false);
}
function normalizeLanguage(lang) {
@@ -568,10 +557,7 @@
}
function loadWidget() {
- if (document.querySelector('script[data-sixmm-support-widget="true"]')) {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
- return;
- }
+ if (document.querySelector('script[data-sixmm-support-widget="true"]')) return;
var initialLang = currentLang();
var initialTheme = currentTheme();
@@ -587,46 +573,19 @@
script.dataset.color = currentAccentColor();
script.dataset.appKey = APP_KEY;
script.onload = function () {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
// The host may have changed while widget.js was loading.
syncWidgetLanguageFromHost(20, true);
syncWidgetThemeFromHost(20, true);
syncWidgetAccessibility();
};
script.onerror = function () {
- document.documentElement.classList.remove('sixmm-support-widget-loading');
script.remove();
- widgetRequested = false;
- openWhenReady = false;
- ensureLauncher();
};
lastTheme = initialTheme;
document.body.appendChild(script);
}
- function ensureLauncher() {
- if (document.getElementById('cs-widget-bubble')) return;
- var launcher = document.getElementById('sixmm-support-launcher');
- if (!launcher) {
- launcher = document.createElement('button');
- launcher.id = 'sixmm-support-launcher';
- launcher.type = 'button';
- launcher.className = 'sixmm-support-launcher';
- launcher.innerHTML = '';
- launcher.addEventListener('click', function () {
- widgetRequested = true;
- openWhenReady = true;
- launcher.setAttribute('aria-busy', 'true');
- loadWidget();
- });
- document.body.appendChild(launcher);
- }
- launcher.setAttribute('aria-busy', widgetRequested ? 'true' : 'false');
- syncWidgetAccessibility();
- }
-
function syncHostNavigation() {
- if (!widgetRequested) { syncWidgetAccessibility(); return; }
if (pendingWidgetDocsLocale !== null) { confirmPendingWidgetDocsNavigation(); return; }
syncWidgetLanguageFromHost(20, false);
}
@@ -638,18 +597,16 @@
document.addEventListener('astro:before-swap', prepareWidgetSwap);
document.addEventListener('astro:page-load', restoreWidgetAfterSwap);
- ensureLauncher();
window.addEventListener('popstate', syncHostNavigation);
window.addEventListener('pageshow', syncHostNavigation);
// The SDK mounts the controls asynchronously as direct body children.
observeWidgetBody();
// Initialize in the background on every fresh page load, so the iframe can
// mount before the user opens support. Astro navigation retains this SDK.
- widgetRequested = true;
loadWidget();
var observer = new MutationObserver(function () {
- if (widgetRequested) syncWidgetThemeFromHost(20, false);
+ syncWidgetThemeFromHost(20, false);
});
observer.observe(document.documentElement, {
attributes: true,
diff --git a/scripts/check-widget-sync.mjs b/scripts/check-widget-sync.mjs
index 9cacc760..8a0f698c 100644
--- a/scripts/check-widget-sync.mjs
+++ b/scripts/check-widget-sync.mjs
@@ -205,11 +205,8 @@ assert.equal(appendedWidgetScript.dataset.appId, undefined, "Legacy appId must n
assert.equal(appendedWidgetScript.dataset.lang, "en");
assert.equal(appendedWidgetScript.dataset.theme, "light");
assert.equal(widgetOpenCalls,0,'Background initialization must not open the support panel');
-const launcher = sandboxDocument.getElementById('sixmm-support-launcher');
-assert.ok(launcher,'A keyboard-accessible support entry must remain visible before SDK load');
-launcher.listeners.click(); launcher.listeners.click();
-assert.ok(appendedWidgetScript, 'An early support click reuses the SDK already loading');
-assert.equal(widgetScriptLoads,1,'Repeated clicks while loading must not duplicate the SDK');
+assert.equal(sandboxDocument.getElementById('sixmm-support-launcher'), null, 'The docs must leave the launcher to the SDK');
+assert.equal(widgetScriptLoads,1,'Background initialization loads one SDK');
assert.equal(appendedWidgetScript.dataset.astroExec, "",
"Astro's script runner must skip the already-executing retained SDK");
appendedWidgetScript.onload();
@@ -403,7 +400,7 @@ sandboxDocument.body.appendChild(bubble);
sandboxDocument.body.appendChild(container);
sandboxDocument.head.appendChild(widgetStyle);
observers.find((observer) => observer.target === sandboxDocument.body).listener();
-assert.equal(widgetOpenCalls,1,'The SDK opens automatically once the first requested panel becomes ready');
+assert.equal(widgetOpenCalls,0,'Mounting the SDK launcher must leave the panel closed');
const status=container.children.find(node=>node.className==='sixmm-support-status');
assert.equal(status.hidden,false,'Cover the empty iframe until the application mounts');
listeners.message({origin:'https://untrusted.example',source:container.iframe.contentWindow,data:{type:'cs-widget-ready'}});