Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🌫️ fix: Dim a Disabled InputNumber Through Its Nested Input (#16820)
Marco Berettae0344846f962
diff --git a/e2e/specs/mock/scenarios/input-number-disabled.spec.ts b/e2e/specs/mock/scenarios/input-number-disabled.spec.tsnew file mode 100644index 0000000000..672eedcaab--- /dev/null+++ b/e2e/specs/mock/scenarios/input-number-disabled.spec.ts@@ -0,0 +1,96 @@+import { expect, test } from '@playwright/test';+import type { Page } from '@playwright/test';+import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/clickhouse';+import { NEW_CHAT_PATH } from '../helpers';++/**+ * `InputNumber` styles the wrapper `rc-input-number` renders, while the disabled state lives on the+ * input inside it. The probe carries the wrapper's own disabled classes, so only the stylesheet+ * the app shipped decides whether a disabled input dims it, or fills it under a `fill` theme.+ */+type Mode = 'light' | 'dark';++const WRAPPER_CLASSES =+ 'bg-transparent text-text-primary has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50 theme-disabled-within:bg-surface-disabled theme-disabled-within:opacity-100';++async function openChat(page: Page, mode: Mode, definition?: { name: string }) {+ await page.addInitScript(+ ([appearance, stored]) => {+ localStorage.setItem('color-theme', appearance as string);+ localStorage.removeItem('theme-colors');+ localStorage.removeItem('theme-name');+ if (stored) {+ localStorage.setItem('theme-definition', JSON.stringify(stored));+ localStorage.setItem('theme-source', 'definition');+ } else {+ localStorage.removeItem('theme-definition');+ localStorage.removeItem('theme-source');+ }+ },+ [mode, definition ?? null] as [string, unknown],+ );+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible({+ timeout: 30000,+ });+ await expect(page.locator('html')).toHaveClass(mode === 'dark' ? /\bdark\b/ : /\blight\b/);+}++async function wrapperLook(page: Page) {+ return page.evaluate((classes) => {+ const read = (disabled: boolean) => {+ const wrapper = document.createElement('div');+ wrapper.className = classes;+ const input = document.createElement('input');+ input.disabled = disabled;+ wrapper.append(input);+ document.body.append(wrapper);+ const style = getComputedStyle(wrapper);+ const look = { opacity: style.opacity, fill: style.backgroundColor, cursor: style.cursor };+ wrapper.remove();+ return look;+ };+ return { enabled: read(false), disabled: read(true) };+ }, WRAPPER_CLASSES);+}++/** Each tag is written out whole: the runner finds a scenario by its literal tag. */+const DEFAULT_CASES = [+ {+ title:+ "a disabled input dims the default light theme's wrapper @scenario:input-number-disabled-default-light",+ mode: 'light',+ },+ {+ title:+ "a disabled input dims the default dark theme's wrapper @scenario:input-number-disabled-default-dark",+ mode: 'dark',+ },+] as const;++test.describe('InputNumber disabled look', () => {+ for (const { title, mode } of DEFAULT_CASES) {+ test(title, async ({ page }) => {+ await openChat(page, mode);++ const { enabled, disabled } = await wrapperLook(page);+ expect(enabled).toEqual({ opacity: '1', fill: 'rgba(0, 0, 0, 0)', cursor: 'auto' });+ expect(disabled).toEqual({+ opacity: '0.5',+ fill: 'rgba(0, 0, 0, 0)',+ cursor: 'not-allowed',+ });+ });+ }++ test('a fill theme paints the wrapper in its disabled fill at full opacity @scenario:input-number-disabled-clickhouse-light', async ({+ page,+ }) => {+ await openChat(page, 'light', clickHouseTheme);++ const { enabled, disabled } = await wrapperLook(page);+ expect(enabled.opacity).toBe('1');+ expect(disabled.opacity).toBe('1');+ expect(disabled.fill).toBe('rgb(223, 223, 223)');+ });+});diff --git a/packages/client/src/components/InputNumber.spec.tsx b/packages/client/src/components/InputNumber.spec.tsxnew file mode 100644index 0000000000..c876d9c490--- /dev/null+++ b/packages/client/src/components/InputNumber.spec.tsx@@ -0,0 +1,20 @@+import React from 'react';+import { render, screen } from '@testing-library/react';+import { InputNumber } from './InputNumber';++describe('InputNumber', () => {+ it('dims the wrapper through the nested disabled input, which is where rc-input-number puts the state', () => {+ const { container } = render(<InputNumber disabled defaultValue={1} aria-label="Amount" />);+ const wrapper = container.firstElementChild as HTMLElement;++ expect(screen.getByLabelText('Amount')).toBeDisabled();+ expect(wrapper).toHaveClass('has-[:disabled]:opacity-50', 'has-[:disabled]:cursor-not-allowed');+ expect(wrapper).not.toHaveClass('disabled:opacity-50');+ });++ it('keeps the fill recipe for a theme that paints disabled controls', () => {+ const { container } = render(<InputNumber defaultValue={1} aria-label="Amount" />);++ expect(container.firstElementChild).toHaveClass('theme-disabled-within:opacity-100');+ });+});diff --git a/packages/client/src/components/InputNumber.tsx b/packages/client/src/components/InputNumber.tsxindex 6d149940ca..4cd75b8b99 100644--- a/packages/client/src/components/InputNumber.tsx+++ b/packages/client/src/components/InputNumber.tsx@@ -18,7 +18,7 @@ const InputNumber: React.ForwardRefExoticComponent<return (<RCInputNumberclassName={cn(- 'border-border-medium text-text-primary placeholder:text-text-tertiary flex max-h-5 w-full rounded-md border bg-transparent px-3 py-2 text-sm focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',+ 'border-border-medium text-text-primary placeholder:text-text-tertiary flex max-h-5 w-full rounded-md border bg-transparent px-3 py-2 text-sm focus:outline-hidden has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50',disabledWithinFillClasses,className ?? '',)}