Skip to content

Commit 813dd03

Browse files
Fix AIChatInput focus & styling (#3470)
Co-authored-by: Samy Pessé <[email protected]>
1 parent 0522dbc commit 813dd03

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/gitbook/src/components/AIChat/AIChatInput.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export function AIChatInput(props: {
3434

3535
useEffect(() => {
3636
if (!disabled && !loading) {
37-
inputRef.current?.focus();
37+
// Add a small delay to ensure the input is rendered before focusing
38+
// This fixes inconsistent focus behaviour across browsers
39+
const timeout = setTimeout(() => {
40+
inputRef.current?.focus();
41+
}, 50);
42+
43+
return () => clearTimeout(timeout);
3844
}
3945
}, [disabled, loading]);
4046

@@ -120,8 +126,8 @@ export function AIChatInput(props: {
120126
arrow
121127
>
122128
<div className="flex cursor-help items-center gap-1 circular-corners:rounded-2xl rounded-corners:rounded-md px-2 py-1 text-tint/7 text-xs transition-all hover:bg-tint">
123-
<span className="-ml-1 circular-corners:rounded-2xl rounded-corners:rounded-md bg-tint-11/7 px-1 py-0.5 font-mono font-semibold text-[0.65rem] text-contrast-tint-11 leading-none">
124-
AI
129+
<span className="-ml-1 rounded-corners:rounded circular-corners:rounded-2xl bg-tint-11/7 px-1 py-0.5 font-mono font-semibold text-[0.65rem] text-contrast-tint-11 leading-none">
130+
{t(language, 'ai_chat_context_badge')}
125131
</span>{' '}
126132
<span>{t(language, 'ai_chat_context_title')}</span>
127133
</div>

packages/gitbook/src/components/primitives/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const variantClasses = {
3636
'bg-transparent',
3737
'text-tint',
3838
'border-0',
39-
'shadow-none',
39+
'!shadow-none',
4040
'hover:bg-primary-hover',
4141
'hover:text-primary-strong',
4242
'hover:scale-1',

0 commit comments

Comments
 (0)