🧹 refactor: Clear Chat Input Design Suppressions Through Existing Variants (#16863)

* refactor: Clear Chat Input Design Suppressions Through Existing Variants

* test: Cover the Chat Composer Send Path After the Suppression Cleanup

* refactor: Keep the FileUpload Action on Its Ghost Pressed Fill
This commit is contained in:
Marco Beretta 2026-10-07 18:23:53 +02:00 • committed by GitHub
parent 91f9d51df5
commit a7e2d66e75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 63 additions and 338 deletions

View file

@ -155,10 +155,7 @@ function Footer({ className, startupConfig, configuredOnly = false }: FooterProp
<React.Fragment key={`footer-element-${index}`}>
{contentRender}
{!isLastElement && (
<div
key={`separator-${index}`}
className="border-border-medium h-2 border-r-[1px]"
/>
<div key={`separator-${index}`} className="border-border-medium h-2 border-r" />
)}
</React.Fragment>
);

View file

@ -111,27 +111,16 @@ export default function FileRow({
}
const renderFiles = () => {
const rowStyle = isRTL
? {
display: 'flex',
flexDirection: 'row-reverse',
flexWrap: 'wrap',
gap: '6px',
width: '100%',
maxWidth: '100%',
}
: {
display: 'flex',
flexWrap: 'wrap',
gap: '6px',
width: '100%',
maxWidth: '100%',
};
return (
/* `items-center` so a card and a thumbnail of different heights share
one baseline instead of hanging from the top of the tallest row. */
<div className="items-center" style={rowStyle as React.CSSProperties}>
<div
className={
isRTL
? 'flex w-full max-w-full flex-row-reverse flex-wrap items-center gap-1.5'
: 'flex w-full max-w-full flex-wrap items-center gap-1.5'
}
>
{files
.reduce(
(acc, current) => {

View file

@ -1,96 +0,0 @@
import { useState } from 'react';
import { Settings2 } from 'lucide-react';
import { TooltipAnchor } from '@librechat/client';
import { Root, Anchor } from '@radix-ui/react-popover';
import { isParamEndpoint, getEndpointField, tConvoUpdateSchema } from 'librechat-data-provider';
import type { TPreset, TInterfaceConfig } from 'librechat-data-provider';
import { EndpointSettings, SaveAsPresetDialog, AlternativeSettings } from '~/components/Endpoints';
import { useSetIndexOptions, useLocalize } from '~/hooks';
import { useGetEndpointsQuery } from '~/data-provider';
import OptionsPopover from './OptionsPopover';
import PopoverButtons from './PopoverButtons';
import { useChatContext } from '~/Providers';
export default function HeaderOptions({
interfaceConfig,
}: {
interfaceConfig?: Partial<TInterfaceConfig>;
}) {
const { data: endpointsConfig } = useGetEndpointsQuery();
const [saveAsDialogShow, setSaveAsDialogShow] = useState<boolean>(false);
const localize = useLocalize();
const { showPopover, conversation, setShowPopover } = useChatContext();
const { setOption } = useSetIndexOptions();
const { endpoint } = conversation ?? {};
const saveAsPreset = () => {
setSaveAsDialogShow(true);
};
if (!endpoint) {
return null;
}
const triggerAdvancedMode = () => setShowPopover((prev) => !prev);
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
const paramEndpoint = isParamEndpoint(endpoint, endpointType);
return (
<Root open={showPopover} onOpenChange={setShowPopover}>
<Anchor>
<div className="my-auto lg:max-w-2xl xl:max-w-3xl">
<span className="flex w-full flex-col items-center justify-center gap-0 md:order-none md:m-auto md:gap-2">
<div className="z-[61] flex w-full items-center justify-center gap-2">
{interfaceConfig?.parameters === true && paramEndpoint === false && (
<TooltipAnchor
id="parameters-button"
aria-label={localize('com_ui_model_parameters')}
description={localize('com_ui_model_parameters')}
tabIndex={0}
role="button"
onClick={triggerAdvancedMode}
data-testid="parameters-button"
className="border-border-light text-text-primary hover:bg-surface-tertiary inline-flex size-10 items-center justify-center rounded-lg border bg-transparent transition-all ease-in-out disabled:pointer-events-none disabled:opacity-50"
>
<Settings2 size={16} aria-hidden="true" />
</TooltipAnchor>
)}
</div>
{interfaceConfig?.parameters === true && paramEndpoint === false && (
<OptionsPopover
visible={showPopover}
saveAsPreset={saveAsPreset}
presetsDisabled={!(interfaceConfig.presets ?? false)}
PopoverButtons={<PopoverButtons />}
closePopover={() => setShowPopover(false)}
>
<div className="px-4 py-4">
<EndpointSettings
className="[&::-webkit-scrollbar]:w-2"
conversation={conversation}
setOption={setOption}
/>
<AlternativeSettings conversation={conversation} setOption={setOption} />
</div>
</OptionsPopover>
)}
{interfaceConfig?.presets === true && (
<SaveAsPresetDialog
open={saveAsDialogShow}
onOpenChange={setSaveAsDialogShow}
preset={
tConvoUpdateSchema.parse({
...conversation,
}) as TPreset
}
/>
)}
</span>
</div>
</Anchor>
</Root>
);
}

View file

@ -186,7 +186,7 @@ function MentionContent({
<Input
ref={initInputRef}
placeholder={localize(placeholder)}
className="bg-surface-secondary text-text-primary mb-1 h-auto w-full rounded-none border-0 p-2 text-sm"
className="bg-surface-secondary mb-1 h-auto w-full rounded-none border-0 p-2"
autoComplete="off"
value={searchValue}
onKeyDown={(e) => {

View file

@ -1,93 +0,0 @@
import { useRef } from 'react';
import { Save } from 'lucide-react';
import { Portal, Content } from '@radix-ui/react-popover';
import { Button, CrossIcon, useOnClickOutside } from '@librechat/client';
import type { ReactNode } from 'react';
import { useLocalize } from '~/hooks';
import { cn } from '~/utils';
type TOptionsPopoverProps = {
children: ReactNode;
visible: boolean;
saveAsPreset: () => void;
closePopover: () => void;
PopoverButtons: ReactNode;
presetsDisabled: boolean;
};
export default function OptionsPopover({
children,
// endpoint,
visible,
saveAsPreset,
closePopover,
PopoverButtons,
presetsDisabled,
}: TOptionsPopoverProps) {
const popoverRef = useRef(null);
useOnClickOutside(
popoverRef,
() => closePopover(),
['dialog-template-content', 'shadcn-button', 'advanced-settings'],
(_target) => {
const target = _target as Element;
if (
target.id === 'presets-button' ||
(target.parentNode instanceof Element && target.parentNode.id === 'presets-button')
) {
return false;
}
const tagName = target.tagName;
return tagName === 'path' || tagName === 'svg' || tagName === 'circle';
},
);
const localize = useLocalize();
const cardStyle =
'shadow-xl rounded-md min-w-[4.6875rem] font-normal bg-surface-secondary border-border-light border text-text-primary';
if (!visible) {
return null;
}
return (
<Portal>
<Content sideOffset={8} align="start" ref={popoverRef} asChild>
<div className="z-[70] flex w-screen flex-col items-center md:w-full md:px-4">
<div
className={cn(
cardStyle,
'bg-surface-secondary flex w-full flex-col overflow-hidden rounded-none border-s-0 border-t px-0 pb-2.5 md:rounded-md md:border lg:w-[46rem] lg:max-w-[calc(100vw-2rem)]',
)}
>
<div className="bg-surface-tertiary flex w-full items-center px-2 py-2">
{presetsDisabled ? null : (
<Button
variant="default"
type="button"
className="h-8 w-[9.375rem] justify-start rounded-md px-2 text-xs font-normal"
onClick={saveAsPreset}
>
<Save className="mr-1 w-[0.875rem]" aria-hidden="true" />
{localize('com_endpoint_save_as_preset')}
</Button>
)}
{PopoverButtons}
<Button
variant="ghost"
size="icon"
type="button"
className="text-text-primary ml-auto size-8"
onClick={closePopover}
aria-label={localize('com_ui_close')}
>
<CrossIcon aria-hidden="true" />
</Button>
</div>
<div>{children}</div>
</div>
</div>
</Content>
</Portal>
);
}

View file

@ -1,6 +1,6 @@
import { useRecoilState } from 'recoil';
import { useSetRecoilState } from 'recoil';
import { Button, MessagesSquared } from '@librechat/client';
import { EModelEndpoint, SettingsViews } from 'librechat-data-provider';
import { Button, MessagesSquared, AssistantIcon, DataIcon } from '@librechat/client';
import type { ReactNode } from 'react';
import { useChatContext } from '~/Providers';
import { useLocalize } from '~/hooks';
@ -11,7 +11,6 @@ type TPopoverButton = {
label: string;
buttonClass: string;
handler: () => void;
type?: 'alternative';
icon: ReactNode;
};
@ -30,7 +29,7 @@ export default function PopoverButtons({
}) {
const localize = useLocalize();
const { conversation, optionSettings, setOptionSettings } = useChatContext();
const [settingsView, setSettingsView] = useRecoilState(store.currentSettingsView);
const setSettingsView = useSetRecoilState(store.currentSettingsView);
const { model: _model, endpoint: _endpoint, endpointType } = conversation ?? {};
const overrideEndpoint = overrideEndpointType ?? _overrideEndpoint;
@ -68,31 +67,8 @@ export default function PopoverButtons({
return null;
}
const additionalButtons: { [key: string]: TPopoverButton[] } = {
[SettingsViews.default]: [
{
label: 'Context Settings',
buttonClass: '',
type: 'alternative',
handler: () => setSettingsView(SettingsViews.advanced),
icon: <DataIcon className={cn('mr-1 h-6 w-[0.875rem]', iconClass)} />,
},
],
[SettingsViews.advanced]: [
{
label: 'Model Settings',
buttonClass: '',
type: 'alternative',
handler: () => setSettingsView(SettingsViews.default),
icon: <AssistantIcon className={cn('mr-1 h-6 w-[0.875rem]', iconClass)} />,
},
],
};
const endpointButtons = (endpointSpecificbuttons[endpoint] as TPopoverButton[] | null) ?? [];
const disabled = true;
return (
<div className="flex w-full justify-between">
<div className="flex items-center justify-start">
@ -113,26 +89,6 @@ export default function PopoverButtons({
</Button>
))}
</div>
{disabled ? null : (
<div className="flex w-[9.375rem] items-center justify-end">
{additionalButtons[settingsView].map((button, index) => (
<Button
key={`button-${index}`}
type="button"
className={cn(
button.buttonClass,
'border-border-medium focus:ring-ring-primary flex justify-center border focus:ring-1',
'text-text-primary hover:bg-surface-hover h-full w-full bg-transparent px-2 py-1 text-xs font-normal',
buttonClass ?? '',
)}
onClick={button.handler}
>
{button.icon}
{button.label}
</Button>
))}
</div>
)}
</div>
);
}

View file

@ -221,7 +221,7 @@ function PromptsCommand({
<Input
ref={initInputRef}
placeholder={localize('com_ui_command_usage_placeholder')}
className="bg-surface-tertiary-alt text-text-primary mb-1 h-auto w-full rounded-none border-0 p-2 text-sm"
className="bg-surface-tertiary-alt mb-1 h-auto w-full rounded-none border-0 p-2"
autoComplete="off"
value={searchValue}
onKeyDown={(e) => {

View file

@ -290,7 +290,7 @@ function SkillsCommandContent({
<Input
ref={initInputRef}
placeholder={localize('com_ui_skills_command_placeholder')}
className="bg-surface-tertiary-alt text-text-primary mb-1 h-auto w-full rounded-none border-0 p-2 text-sm"
className="bg-surface-tertiary-alt mb-1 h-auto w-full rounded-none border-0 p-2"
autoComplete="off"
value={searchValue}
onKeyDown={(e) => {

View file

@ -208,13 +208,7 @@ export default function StreamAudio({ index = 0 }) {
ref={audioRef}
controls
controlsList="nodownload nofullscreen noremoteplayback"
style={{
position: 'absolute',
overflow: 'hidden',
display: 'none',
height: '0px',
width: '0px',
}}
className="absolute hidden size-0 overflow-hidden"
src={globalAudioURL ?? undefined}
id={globalAudioId}
autoPlay

View file

@ -414,13 +414,13 @@ export default function Breakdown({
<HoverCardTrigger asChild>
<Button
type="button"
variant="ghost"
variant="quiet"
size="icon"
aria-label={localize('com_ui_context_insights')}
aria-expanded={insightsOpen}
aria-controls={insightsOpen ? insightsId : undefined}
data-testid="context-insights-toggle"
className="text-text-secondary size-6"
className="size-6"
onFocus={() => setInsightsOpen(true)}
onBlur={() => setInsightsOpen(false)}
onClick={() => setInsightsOpen(true)}
@ -737,7 +737,7 @@ export default function Breakdown({
{langfuseSessionUrl && (
<>
<div className="border-border-light border-t" role="separator" />
<Button asChild variant="link" className="h-auto w-full justify-between p-0">
<Button asChild variant="link" size="bare" className="w-full justify-between">
<a href={langfuseSessionUrl} target="_blank" rel="noopener noreferrer">
<span>{localize('com_ui_langfuse_view_session')}</span>
<ExternalLink className="size-4 shrink-0" aria-hidden="true" />

View file

@ -134,7 +134,7 @@ function TokenUsageIndicator({
busy={compaction.isCompacting}
trigger={(open) =>
compaction.isCompacting && !open ? (
<Spinner className="text-text-secondary size-5" />
<Spinner tone="secondary" className="size-5" />
) : (
<span
role="meter"

View file

@ -96,7 +96,7 @@ function RecordContent({
<>
{placeholder}
<div className="flex justify-center py-4" role="status">
<Spinner className="text-text-secondary size-4" />
<Spinner tone="secondary" className="size-4" />
<span className="sr-only">{localize('com_ui_trace_loading')}</span>
</div>
</>

View file

@ -552,7 +552,7 @@ function Ledger({
</span>
)}
{model.mode === 'full' && technicalName != null && (
<span className="text-text-tertiary hidden min-w-0 shrink-[6] truncate font-mono text-[11px] lg:inline">
<span className="text-text-tertiary text-2xs hidden min-w-0 shrink-[6] truncate font-mono lg:inline">
{technicalName}
</span>
)}
@ -610,7 +610,7 @@ function Ledger({
aria-hidden="true"
className={cn(
grid,
'border-border-light bg-presentation text-text-secondary sticky top-0 z-10 h-7 items-center gap-2 border-b px-2 text-[11px] font-medium tracking-wide uppercase',
'border-border-light bg-presentation text-text-secondary text-2xs sticky top-0 z-10 h-7 items-center gap-2 border-b px-2 font-medium tracking-wide uppercase',
)}
>
<span>{localize('com_ui_trace_column_name')}</span>

View file

@ -259,7 +259,7 @@ function Timeline({
)}
</div>
<div
className="text-text-secondary flex justify-between text-[11px] tabular-nums"
className="text-text-secondary text-2xs flex justify-between tabular-nums"
aria-hidden="true"
>
{TICKS.map((fraction) => (

View file

@ -370,7 +370,7 @@ export default function Viewer({
if (recordsQuery.isLoading) {
return (
<div role="status" className="flex flex-1 items-center justify-center gap-2">
<Spinner className="text-text-secondary size-5" />
<Spinner tone="secondary" className="size-5" />
<span className="sr-only">{localize('com_ui_trace_loading')}</span>
</div>
);

View file

@ -116,10 +116,10 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
render={
<Button
type="button"
variant="ghost"
variant="quiet"
size="icon"
aria-label={localize('com_ui_collapse')}
className="text-text-secondary size-auto rounded-md p-1"
className="size-auto rounded-md p-1"
onClick={() => setOpen(false)}
>
<ChevronDown className="size-4" aria-hidden="true" />
@ -226,12 +226,12 @@ export const PendingToolApprovalButton = memo(function PendingToolApprovalButton
return (
<Button
type="button"
variant="ghost"
variant="quiet"
size="sm"
aria-expanded={open}
aria-controls="pending-tool-approval-panel"
onClick={() => setOpen((current) => !current)}
className="text-text-secondary h-8 gap-1.5 rounded-full px-2"
className="h-8 gap-1.5 rounded-full px-2"
data-testid="pending-tool-approval-button"
>
<ShieldQuestion className="size-4" aria-hidden="true" />

View file

@ -69,7 +69,7 @@ export default function AskOptions({
>
<span
className={cn(
'flex size-5 shrink-0 items-center justify-center rounded-md text-[11px] font-medium tabular-nums',
'text-2xs flex size-5 shrink-0 items-center justify-center rounded-md font-medium tabular-nums',
isChecked
? 'bg-surface-submit text-text-on-status'
: 'bg-surface-tertiary text-text-secondary',

View file

@ -0,0 +1,26 @@
import { expect, test } from '@playwright/test';
import {
MOCK_ENDPOINTS,
NEW_CHAT_PATH,
mockReply,
selectMockEndpoint,
sendMessage,
} from '../helpers';
/**
* The composer's surrounding controls moved onto shared Button, Spinner and size roles.
* This sends a message through the real composer and reads the reply and the footer rule.
*/
test.describe.configure({ timeout: 120_000 });
test.describe('chat composer surfaces', () => {
test('sends a message and renders the reply with the composer intact @scenario:composer-send-and-reply', async ({
page,
}) => {
await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);
await sendMessage(page, 'composer surfaces');
await expect(mockReply(page)).toBeVisible({ timeout: 30000 });
await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible();
});
});

View file

@ -98,11 +98,6 @@
"count": 1
}
},
"client/src/components/Chat/Footer.tsx": {
"shadcn/no-arbitrary-values": {
"count": 1
}
},
"client/src/components/Chat/Input/AskUserQuestionPopover.tsx": {
"shadcn/no-restyle": {
"count": 6
@ -132,11 +127,6 @@
"count": 3
}
},
"client/src/components/Chat/Input/Files/FileRow.tsx": {
"shadcn/no-inline-styles": {
"count": 7
}
},
"client/src/components/Chat/Input/Files/FileUpload.tsx": {
"shadcn/no-restyle": {
"count": 11
@ -183,11 +173,6 @@
"count": 13
}
},
"client/src/components/Chat/Input/HeaderOptions.tsx": {
"shadcn/no-restyle": {
"count": 9
}
},
"client/src/components/Chat/Input/MCPConfigDialog.tsx": {
"shadcn/no-restyle": {
"count": 17
@ -195,25 +180,20 @@
},
"client/src/components/Chat/Input/Mention.tsx": {
"shadcn/no-restyle": {
"count": 6
}
},
"client/src/components/Chat/Input/OptionsPopover.tsx": {
"shadcn/no-restyle": {
"count": 5
"count": 4
}
},
"client/src/components/Chat/Input/PopoverButtons.tsx": {
"shadcn/no-restyle": {
"count": 22
"count": 11
},
"shadcn/require-static-classes": {
"count": 7
"count": 3
}
},
"client/src/components/Chat/Input/PromptsCommand.tsx": {
"shadcn/no-restyle": {
"count": 6
"count": 4
}
},
"client/src/components/Chat/Input/QuoteButton.tsx": {
@ -223,22 +203,12 @@
},
"client/src/components/Chat/Input/SkillsCommand.tsx": {
"shadcn/no-restyle": {
"count": 6
}
},
"client/src/components/Chat/Input/StreamAudio.tsx": {
"shadcn/no-inline-styles": {
"count": 3
"count": 4
}
},
"client/src/components/Chat/Input/TokenUsage/Breakdown.tsx": {
"shadcn/no-restyle": {
"count": 12
}
},
"client/src/components/Chat/Input/TokenUsage/index.tsx": {
"shadcn/no-restyle": {
"count": 1
"count": 10
}
},
"client/src/components/Chat/Landing.tsx": {
@ -629,37 +599,19 @@
"count": 3
}
},
"client/src/components/Chat/Trace/Inspector.tsx": {
"shadcn/no-restyle": {
"count": 1
}
},
"client/src/components/Chat/Trace/Ledger.tsx": {
"shadcn/no-arbitrary-values": {
"count": 2
},
"shadcn/no-inline-styles": {
"count": 4
}
},
"client/src/components/Chat/Trace/Timeline.tsx": {
"shadcn/no-arbitrary-values": {
"count": 1
}
},
"client/src/components/Chat/Trace/Viewer.tsx": {
"shadcn/no-restyle": {
"count": 3
"count": 2
}
},
"client/src/components/Chat/approval/Review.tsx": {
"shadcn/no-restyle": {
"count": 7
}
},
"client/src/components/Chat/ask/options.tsx": {
"shadcn/no-arbitrary-values": {
"count": 1
"count": 5
}
},
"client/src/components/Conversations/Convo.tsx": {