Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/lib/web-select.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { isDesktop } from "@/lib/transport";

/** Native `<select>` styling override for web mode.
/** Normalize `<select>` chrome across web and desktop webviews.
*
* macOS WebKit and Linux Chromium render native select chrome differently
* from each other and from Tauri's webview. Apply this `style` plus a
* matching className to keep `<select>` elements consistent across web /
* desktop. In Tauri (desktop), returns `undefined` so the native chrome
* is preserved.
* Native macOS Aqua chrome (Tauri's WKWebView on older macOS, e.g.
* 15.x Sequoia) renders select controls as heavy Aqua-style buttons that
* clash with the rest of the flat UI. Apple's newer macOS releases ship
* a flatter native chrome, but we can't rely on that across user OS
* versions. Stripping native chrome with `appearance: none` and applying
* a matching custom arrow gives a single consistent rendering everywhere.
*/
export const webSelectStyle: React.CSSProperties | undefined = !isDesktop()
? {
appearance: "none",
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath d='M4 1L7 4.5H1Z' fill='%23888'/%3E%3Cpath d='M4 11L1 7.5H7Z' fill='%23888'/%3E%3C/svg%3E")`,
backgroundRepeat: "no-repeat",
backgroundPosition: "right 8px center",
paddingRight: "24px",
}
: undefined;
export const webSelectStyle: React.CSSProperties = {
WebkitAppearance: "none",
appearance: "none",
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath d='M4 1L7 4.5H1Z' fill='%23888'/%3E%3Cpath d='M4 11L1 7.5H7Z' fill='%23888'/%3E%3C/svg%3E")`,
backgroundRepeat: "no-repeat",
backgroundPosition: "right 8px center",
paddingRight: "24px",
};

/** True in web mode — used to swap `rounded-[6px] h-[26px]` for the more
* permissive Tauri styling (`rounded-lg py-1.5`). */
export const isWeb = !isDesktop();
/** Use the normalized layout (`rounded-[6px] h-[26px]`) instead of the
* legacy desktop-only (`rounded-lg py-1.5`). Now true everywhere since
* desktop also normalizes — kept as a constant for callers that gate
* className choice on it; can be inlined later. */
export const isWeb = true;
Loading