Skip to content

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

🎨 refactor: Theme the Retry Action Radius and the Select Arrow (#17360)

Marco Beretta821f4b3009fd
diff --git a/client/src/style.css b/client/src/style.css
index f7760c35a8..506eff6826 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -342,10 +342,26 @@ html.high-contrast.dark .btn-neutral:hover {
--tw-shadow: 0 0 transparent;
-webkit-appearance: none;
appearance: none;
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%238e8ea0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
- background-position: right 0.5rem center;
+ background-image:
+ linear-gradient(
+ to top right,
+ transparent calc(50% - 0.056em),
+ currentColor calc(50% - 0.056em),
+ currentColor calc(50% + 0.056em),
+ transparent calc(50% + 0.056em)
+ ),
+ linear-gradient(
+ to bottom right,
+ transparent calc(50% - 0.056em),
+ currentColor calc(50% - 0.056em),
+ currentColor calc(50% + 0.056em),
+ transparent calc(50% + 0.056em)
+ );
+ background-position:
+ right calc(0.5rem + 0.75em) center,
+ right calc(0.5rem + 0.45em) center;
background-repeat: no-repeat;
- background-size: 1.5em 1.5em;
+ background-size: 0.3em 0.3em;
padding-inline-end: 2.5rem;
background-color: rgb(var(--select-fill));
border-color: rgb(var(--select-edge));
@@ -355,7 +371,18 @@ html.high-contrast.dark .btn-neutral:hover {
line-height: 1.5rem;
}
[dir='rtl'] select {
- background-position: left 0.5rem center;
+ background-position:
+ left calc(0.5rem + 0.45em) center,
+ left calc(0.5rem + 0.75em) center;
+ }
+}
+
+/* Forced colors computes `background-image` to none unless it holds a `url()`, which
+ * removes the gradient arrow; hand the indicator back to the browser. */
+@media (forced-colors: active) {
+ select {
+ -webkit-appearance: menulist;
+ appearance: menulist;
}
}
diff --git a/client/src/style.spec.ts b/client/src/style.spec.ts
index 3f3244914d..91e0e2847f 100644
--- a/client/src/style.spec.ts
+++ b/client/src/style.spec.ts
@@ -126,3 +126,20 @@ describe('code typography', () => {
expect(hosted).toContain(firstFamily(utility()?.value ?? ''));
});
});
+
+describe('select arrow', () => {
+ const stylesheet = fs.readFileSync(path.join(__dirname, 'style.css'), 'utf8');
+ const rule = /^ {2}select \{[\s\S]*?^ {2}\}/m.exec(stylesheet)?.[0] ?? '';
+
+ it('is drawn in the text color, so it follows light, dark and themed modes', () => {
+ expect(rule).toContain('currentColor');
+ expect(rule).not.toMatch(/url\(|#[0-9a-f]{3,8}\b|%23/i);
+ });
+
+ it('falls back to the native indicator when forced colors drops the gradients', () => {
+ const forced = /@media \(forced-colors: active\) \{\s*select \{[^}]*appearance: menulist/.exec(
+ stylesheet,
+ );
+ expect(forced).not.toBeNull();
+ });
+});
diff --git a/e2e/specs/mock/scenarios/select-arrow-theme.spec.ts b/e2e/specs/mock/scenarios/select-arrow-theme.spec.ts
new file mode 100644
index 0000000000..8a214c331c
--- /dev/null
+++ b/e2e/specs/mock/scenarios/select-arrow-theme.spec.ts
@@ -0,0 +1,31 @@
+import { expect, test } from '@playwright/test';
+import { NEW_CHAT_PATH } from '../helpers';
+
+test.describe.configure({ timeout: 60_000 });
+test.use({ viewport: { width: 1280, height: 800 } });
+
+test.describe('select arrow', () => {
+ test('a native select draws its arrow in the text color of the active mode @scenario:select-arrow-follows-text-color', async ({
+ page,
+ }) => {
+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
+ await expect(page.locator('#prompt-textarea')).toBeVisible({ timeout: 15000 });
+
+ const paint = await page.evaluate(() => {
+ const select = document.createElement('select');
+ document.body.append(select);
+ const style = getComputedStyle(select);
+ const result = {
+ color: style.color,
+ image: style.backgroundImage,
+ dark: document.documentElement.classList.contains('dark'),
+ };
+ select.remove();
+ return result;
+ });
+
+ expect(paint.image).toContain('linear-gradient');
+ expect(paint.image).not.toContain('url(');
+ expect(paint.image).toContain(paint.color);
+ });
+});
diff --git a/packages/client/src/components/Button.tsx b/packages/client/src/components/Button.tsx
index 574e0e0015..8a8ddfc581 100644
--- a/packages/client/src/components/Button.tsx
+++ b/packages/client/src/components/Button.tsx
@@ -237,7 +237,7 @@ const buttonVariantRecipe = cva(
/** A small text action in the secondary ink beside a status line, such as a failed
* steer's Retry or a pending one's Cancel; it rises to the primary ink under the pointer. */
'text-action':
- 'rounded text-xs text-text-secondary hover:text-text-primary focus-visible:ring-offset-0',
+ 'rounded-sm text-xs text-text-secondary hover:text-text-primary focus-visible:ring-offset-0',
/** The content of a list row whose row owns the highlight, such as a composer palette
* entry: it lays the row out and takes the pointer, and leaves fill and ink to the row. */
'row-content':
diff --git a/packages/client/src/theme/primitives.spec.ts b/packages/client/src/theme/primitives.spec.ts
index bd7b89d14d..dcc2d7575a 100644
--- a/packages/client/src/theme/primitives.spec.ts
+++ b/packages/client/src/theme/primitives.spec.ts
@@ -119,6 +119,9 @@ function hardCoded(file: string): string[] {
for (const match of text.matchAll(/\b(?:rounded|shadow)(?:-[a-z]{1,2})?-\[[^\]]*\]/g)) {
found.add(`${file}: arbitrary ${match[0]}`);
}
+ for (const match of text.matchAll(/(?<=['"` ])(?:rounded|shadow)(?=['"` ])/g)) {
+ found.add(`${file}: bare ${match[0]}`);
+ }
for (const match of text.matchAll(/\b(?:h|w|size|min-h)-(?:[1-9][0-9.]*|0\.[0-9]+)\b(?!\/)/g)) {
found.add(`${file}: fixed size ${match[0]}`);
}
diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.css
index b5ecae9d05..80afdfdc6e 100644
--- a/packages/client/src/theme/tokens.css
+++ b/packages/client/src/theme/tokens.css
@@ -236,8 +236,9 @@
/* The plain radius, font, type scale and shadow utilities read theme-owned properties, so a theme
* definition reshapes the existing `rounded-*`, `font-sans`, `font-mono`, `text-*` and `shadow-*`
* call sites without a migration, in the app and in a consumer alike. The defaults in `defaults.css` reproduce the scale
- * the app's utilities resolved to before. Bare `rounded` stays Tailwind's fixed 0.25rem: `sm` keeps
- * its px offset, so the two part at a non-16px root. Bare `shadow` reads `--shadow`, which has
+ * the app's utilities resolved to before. Bare `rounded` stays Tailwind's fixed
+ * 0.25rem and is not used in the package: write `rounded-sm`, which equals it at a 16px root and
+ * follows the theme. Bare `shadow` reads `--shadow`, which has
* always equalled `sm`, and follows it. A shadow held in a variable cannot be recolored by a
* `shadow-<color>` modifier; nothing in the app or the package uses one. */
@theme inline {