Skip to content

Commit 169ffe4

Browse files
committed
fix: hide iframe before full load to avoid page flicker
1 parent 108ac72 commit 169ffe4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/index.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export const InlineSearch = () => {
154154
`;
155155
iframeDoc.head.appendChild(style);
156156

157+
// Show iframe now that CSS is injected (eliminates FOUC)
158+
iframe.style.visibility = 'visible';
159+
iframe.style.opacity = '1';
160+
157161
// Intercept all link clicks and navigate parent window
158162
const handleLinkClick = (e) => {
159163
const link = e.target.closest('a');
@@ -187,6 +191,11 @@ export const InlineSearch = () => {
187191
});
188192
} catch (e) {
189193
console.error('Cannot inject styles into iframe:', e);
194+
// Show iframe even on error to avoid permanent blank state
195+
if (iframe) {
196+
iframe.style.visibility = 'visible';
197+
iframe.style.opacity = '1';
198+
}
190199
}
191200
};
192201

@@ -298,7 +307,10 @@ export const InlineSearch = () => {
298307
style={{
299308
width: '100%',
300309
height: '100%',
301-
border: 'none'
310+
border: 'none',
311+
visibility: 'hidden',
312+
opacity: '0',
313+
transition: 'opacity 0.15s ease-in-out'
302314
}}
303315
title="Search Documentation"
304316
/>

0 commit comments

Comments
 (0)