The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Remove focus rings from search inputs (#28638)
Raphaël Bosi475a97259364
diff --git a/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx b/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdxindex 34b96c43ff5..d9fb8989dff 100644--- a/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx+++ b/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx@@ -39,6 +39,10 @@Disables the text input. Controls in actions keep their own state.</ParamField>+<ParamField body="hasFocusRing" type="boolean" default="false">+ Shows the group focus border. Defaults to false for all search inputs. Set true to opt in. Error styling remains visible.+</ParamField>+<ParamField body="id" type="string">Input ID, generated when omitted.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/components/navigation/dropdown.mdx b/packages/twenty-docs/snippets/ui/generated/components/navigation/dropdown.mdxindex e20bef72969..fe8cfd519d7 100644--- a/packages/twenty-docs/snippets/ui/generated/components/navigation/dropdown.mdx+++ b/packages/twenty-docs/snippets/ui/generated/components/navigation/dropdown.mdx@@ -369,6 +369,10 @@The default value of the input. Use when uncontrolled.</ParamField>+<ParamField body="Search.hasFocusRing" type="boolean" default="false">+ Shows the search input focus outline. Defaults to false for all dropdown searches. Set true to opt in. Error styling remains visible.+</ParamField>+<ParamField body="Search.onValueChange" type="((value: string) => void)">Called with the search text on every change. The application filters the results.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/input-group.mdx b/packages/twenty-docs/snippets/ui/generated/input/input-group.mdxindex bb1611988f0..3d5d40c1334 100644--- a/packages/twenty-docs/snippets/ui/generated/input/input-group.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/input-group.mdx@@ -15,6 +15,10 @@Content rendered after the input, such as a suffix or a button.</ParamField>+<ParamField body="hasFocusRing" type="boolean" default="true">+ Set false to keep the group border unchanged on focus. Defaults to true. Error styling remains visible.+</ParamField>+<ParamField body="ref" type="Ref<HTMLDivElement>">Ref to the layout element, a div by default.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/input.mdx b/packages/twenty-docs/snippets/ui/generated/input/input.mdxindex 90237e52e6e..f2b260a459e 100644--- a/packages/twenty-docs/snippets/ui/generated/input/input.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/input.mdx@@ -20,6 +20,10 @@The default value of the input. Use when uncontrolled.</ParamField>+<ParamField body="hasFocusRing" type="boolean" default="true">+ Set false to hide the focus border or outline while keeping errors visible. Defaults to true. InputGroup controls grouped focus styling.+</ParamField>+<ParamField body="onValueChange" type="((value: string, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)">Receives the next string value and Base UI details, including the native event, reason and cancellation methods.</ParamField>diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsxindex 825ef2f34f9..8d6ca87f230 100644--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx@@ -228,6 +228,7 @@ export const SidePanelTopBar = ({<><Inputvariant="plain"+ hasFocusRing={false}size="sm"aria-label={t`Search`}data-testid={SIDE_PANEL_FOCUS_ID}diff --git a/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts b/packages/twenty-ui/docs/dropdownPartPropDescriptions.tsindex bd3c5f29f16..290cdcd1f8d 100644--- a/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts+++ b/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts@@ -93,6 +93,8 @@ export const DROPDOWN_PART_PROP_DESCRIPTIONS = {'Element or function rendered as the group. Functions receive supplied props and `{ value, multiple }` state. Forward the props and ref.',} satisfies Partial<Record<keyof DropdownSelectionGroupProps, string>>,Search: {+ hasFocusRing:+ 'Shows the search input focus outline. Defaults to false for all dropdown searches. Set true to opt in. Error styling remains visible.',onValueChange:'Called with the search text on every change. The application filters the results.',} satisfies Partial<Record<keyof DropdownSearchProps, string>>,diff --git a/packages/twenty-ui/docs/inputGroupPropDescriptions.ts b/packages/twenty-ui/docs/inputGroupPropDescriptions.tsindex e3db839df00..472e52d7b91 100644--- a/packages/twenty-ui/docs/inputGroupPropDescriptions.ts+++ b/packages/twenty-ui/docs/inputGroupPropDescriptions.ts@@ -2,6 +2,8 @@ import { type InputGroupProps } from '../src/primitives/input/InputGroup/types/Iexport const INPUT_GROUP_PROP_DESCRIPTIONS = {size: 'Visual size of the layout and default size for inputs that omit size. Defaults to md.',+ hasFocusRing:+ 'Set false to keep the group border unchanged on focus. Defaults to true. Error styling remains visible.',ref: 'Ref to the layout element, a div by default.',render:'Customizes the layout element. Forward its props, children and ref. Native control props belong on the child input.',diff --git a/packages/twenty-ui/docs/inputPropDescriptions.ts b/packages/twenty-ui/docs/inputPropDescriptions.tsindex 039a5c95a8e..c25a4c737f8 100644--- a/packages/twenty-ui/docs/inputPropDescriptions.ts+++ b/packages/twenty-ui/docs/inputPropDescriptions.ts@@ -4,6 +4,8 @@ export const INPUT_PROP_DESCRIPTIONS = {variant:'default keeps the field frame. plain removes fill, border, radius and padding and uses natural height. Its outline follows native :focus-visible, including pointer focus or autofocus on text inputs; invalid state uses a danger outline. InputGroup always owns the grouped frame.',size: 'Visual size. Explicit input size takes precedence over the InputGroup default, then md applies. Group layout still sets the surrounding height.',+ hasFocusRing:+ 'Set false to hide the focus border or outline while keeping errors visible. Defaults to true. InputGroup controls grouped focus styling.',ref: 'Ref to the native input element.',render:'Composes the native input with a custom element or render callback. Forward the supplied props and ref to an input.',diff --git a/packages/twenty-ui/docs/searchInputPropDescriptions.ts b/packages/twenty-ui/docs/searchInputPropDescriptions.tsindex 151a701a3af..c3ef977db86 100644--- a/packages/twenty-ui/docs/searchInputPropDescriptions.ts+++ b/packages/twenty-ui/docs/searchInputPropDescriptions.ts@@ -8,6 +8,8 @@ export const SEARCH_INPUT_PROP_DESCRIPTIONS = {onChange: 'Native input change event handler.',ref: 'Ref to the native input element.',size: 'Visual size of the input group.',+ hasFocusRing:+ 'Shows the group focus border. Defaults to false for all search inputs. Set true to opt in. Error styling remains visible.',placeholder:'Hint shown when the input is empty. Also used as the accessible name if no explicit label is supplied.',actions:diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex fa750a2d0e1..81d57232849 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -3791,6 +3791,13 @@"defaultValue": null,"description": "The default value of the input. Use when uncontrolled."},+ {+ "name": "hasFocusRing",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set false to hide the focus border or outline while keeping errors visible. Defaults to true. InputGroup controls grouped focus styling."+ },{"name": "onValueChange","type": "((value: string, eventDetails: { reason: \"none\"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)",@@ -3854,6 +3861,13 @@"defaultValue": null,"description": "Content rendered after the input, such as a suffix or a button."},+ {+ "name": "hasFocusRing",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set false to keep the group border unchanged on focus. Defaults to true. Error styling remains visible."+ },{"name": "ref","type": "Ref<HTMLDivElement>",@@ -12718,6 +12732,13 @@"defaultValue": null,"description": "The default value of the input. Use when uncontrolled."},+ {+ "name": "hasFocusRing",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Shows the search input focus outline. Defaults to false for all dropdown searches. Set true to opt in. Error styling remains visible."+ },{"name": "onValueChange","type": "((value: string) => void)",@@ -14970,6 +14991,13 @@"defaultValue": null,"description": "Disables the text input. Controls in actions keep their own state."},+ {+ "name": "hasFocusRing",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Shows the group focus border. Defaults to false for all search inputs. Set true to opt in. Error styling remains visible."+ },{"name": "id","type": "string",diff --git a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsxindex de7cf14561f..c842c927a1c 100644--- a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx+++ b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx@@ -13,6 +13,7 @@ export const SearchInput = ({placeholder,actions,size = 'md',+ hasFocusRing = false,id,'aria-label': ariaLabel,'aria-labelledby': ariaLabelledby,@@ -27,6 +28,7 @@ export const SearchInput = ({<InputGroupclassName={styles.inputGroup}size={size}+ hasFocusRing={hasFocusRing}startElement={<IconSearchclassName={styles.searchIcon}diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsxindex 5a696956d8e..7ad47f93c85 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx@@ -13,6 +13,7 @@ export const DropdownSearch = ({onValueChange,onBlur,className,+ hasFocusRing = false,value,ref,...props@@ -32,6 +33,7 @@ export const DropdownSearch = ({value={value}data-dropdown-search=""variant="plain"+ hasFocusRing={hasFocusRing}className={mergeClassNames(styles.search, className)}onValueChange={(value) => onValueChange?.(value)}onBlur={(event) => {diff --git a/packages/twenty-ui/src/primitives/input/Input/Input.module.scss b/packages/twenty-ui/src/primitives/input/Input/Input.module.scssindex 267746aaa78..ebe9f05ef9b 100644--- a/packages/twenty-ui/src/primitives/input/Input/Input.module.scss+++ b/packages/twenty-ui/src/primitives/input/Input/Input.module.scss@@ -28,6 +28,10 @@--tw-input-border-color: var(--t-color-blue);}+ &[data-focus-ring='false'] {+ --tw-input-border-color: var(--t-border-color-medium);+ }+&[aria-invalid='true'],&[data-invalid] {--tw-input-border-color: var(--t-border-color-danger);@@ -47,7 +51,9 @@padding: 0;&:not([data-grouped]) {- @include focus-ring;+ &:not([data-focus-ring='false'], [aria-invalid='true'], [data-invalid]) {+ @include focus-ring;+ }&[aria-invalid='true'],&[data-invalid] {diff --git a/packages/twenty-ui/src/primitives/input/Input/Input.tsx b/packages/twenty-ui/src/primitives/input/Input/Input.tsxindex 0fd37ce1921..0b12751115d 100644--- a/packages/twenty-ui/src/primitives/input/Input/Input.tsx+++ b/packages/twenty-ui/src/primitives/input/Input/Input.tsx@@ -12,6 +12,7 @@ import { type InputProps } from './types/InputProps';export const Input = ({size,variant = 'default',+ hasFocusRing = true,className,...props}: InputProps) => {@@ -28,6 +29,7 @@ export const Input = ({className,)}data-variant={resolvedVariant}+ data-focus-ring={hasFocusRing}data-grouped={isGrouped || undefined}/>);diff --git a/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts b/packages/twenty-ui/src/primitives/input/Input/types/InputProps.tsindex 4cd5fbca894..d32ec041fd1 100644--- a/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts+++ b/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts@@ -6,4 +6,5 @@ import { type InputVariant } from '@ui/primitives/input/types/InputVariant';export type InputProps = Omit<InputPrimitive.Props, 'size'> & {size?: InputSize;variant?: InputVariant;+ hasFocusRing?: boolean;};diff --git a/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.module.scss b/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.module.scssindex 16dba5f5bc6..170038adc90 100644--- a/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.module.scss+++ b/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.module.scss@@ -19,6 +19,10 @@color: var(--t-font-color-secondary);}+ &[data-focus-ring='false'] {+ --tw-input-group-border-color: var(--t-border-color-medium);+ }+&:has([aria-invalid='true'], [data-invalid]) {--tw-input-group-border-color: var(--t-border-color-danger);}diff --git a/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.tsx b/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.tsxindex f30c8abf186..f9ed776ae3d 100644--- a/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.tsx+++ b/packages/twenty-ui/src/primitives/input/InputGroup/InputGroup.tsx@@ -8,6 +8,7 @@ import { type InputGroupProps } from './types/InputGroupProps';export const InputGroup = ({size = 'md',+ hasFocusRing = true,startElement,endElement,className,@@ -22,6 +23,7 @@ export const InputGroup = ({props: {...props,className: clsx(styles.root, styles[size], className),+ 'data-focus-ring': hasFocusRing,children: (<>{isRenderableAdornment(startElement) && (diff --git a/packages/twenty-ui/src/primitives/input/InputGroup/types/InputGroupProps.ts b/packages/twenty-ui/src/primitives/input/InputGroup/types/InputGroupProps.tsindex 9131b8b58fc..b2caffa47b0 100644--- a/packages/twenty-ui/src/primitives/input/InputGroup/types/InputGroupProps.ts+++ b/packages/twenty-ui/src/primitives/input/InputGroup/types/InputGroupProps.ts@@ -5,6 +5,7 @@ import { type InputSize } from '@ui/primitives/input/types/InputSize';export type InputGroupProps = useRender.ComponentProps<'div'> & {size?: InputSize;+ hasFocusRing?: boolean;/** Content rendered before the input, such as a prefix or an icon. */startElement?: ReactNode;/** Content rendered after the input, such as a suffix or a button. */