The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Normalize VisuallyHidden API (#27388)
Raphaël Bosi2d0a0bbbf682
diff --git a/packages/twenty-docs/docs.json b/packages/twenty-docs/docs.jsonindex d9ed0201fa5..32748c58661 100644--- a/packages/twenty-docs/docs.json+++ b/packages/twenty-docs/docs.json@@ -537,7 +537,7 @@{"group": "Accessibility","pages": [- "ui/primitives/accessibility/visibility-hidden"+ "ui/primitives/accessibility/visually-hidden"]},{diff --git a/packages/twenty-docs/navigation/base-structure.json b/packages/twenty-docs/navigation/base-structure.jsonindex 3575816e474..8e913305378 100644--- a/packages/twenty-docs/navigation/base-structure.json+++ b/packages/twenty-docs/navigation/base-structure.json@@ -548,7 +548,7 @@{"key": "uiAccessibility","label": "Accessibility",- "pages": ["ui/primitives/accessibility/visibility-hidden"]+ "pages": ["ui/primitives/accessibility/visually-hidden"]},{"key": "uiDataDisplay",diff --git a/packages/twenty-docs/snippets/ui/generated/accessibility/visibility-hidden.mdx b/packages/twenty-docs/snippets/ui/generated/accessibility/visually-hidden.mdxsimilarity index 69%rename from packages/twenty-docs/snippets/ui/generated/accessibility/visibility-hidden.mdxrename to packages/twenty-docs/snippets/ui/generated/accessibility/visually-hidden.mdxindex f8948970b0d..43924c63784 100644--- a/packages/twenty-docs/snippets/ui/generated/accessibility/visibility-hidden.mdx+++ b/packages/twenty-docs/snippets/ui/generated/accessibility/visually-hidden.mdx@@ -11,6 +11,10 @@* npx nx generate:ui twenty-docs*/}-<ParamField body="children" type="ReactNode" required>+<ParamField body="children" type="ReactNode">Content hidden visually while remaining available to assistive technology.</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Element or render function composed with the hidden span props and ref.+</ParamField>diff --git a/packages/twenty-docs/ui/accessibility.mdx b/packages/twenty-docs/ui/accessibility.mdxindex b24bdf6421a..cd52df22c6e 100644--- a/packages/twenty-docs/ui/accessibility.mdx+++ b/packages/twenty-docs/ui/accessibility.mdx@@ -24,7 +24,7 @@ export const EmailField = () => ();```-Use [VisibilityHidden](/ui/primitives/accessibility/visibility-hidden) when supporting text should remain available to assistive technology without being displayed.+Use [VisuallyHidden](/ui/primitives/accessibility/visually-hidden) when supporting text should remain available to assistive technology without being displayed.Placeholders supplement labels; they do not replace them. For a control without visible text, supply an accessible name using `aria-label` or `aria-labelledby`.diff --git a/packages/twenty-docs/ui/primitives/accessibility/visibility-hidden.mdx b/packages/twenty-docs/ui/primitives/accessibility/visually-hidden.mdxsimilarity index 52%rename from packages/twenty-docs/ui/primitives/accessibility/visibility-hidden.mdxrename to packages/twenty-docs/ui/primitives/accessibility/visually-hidden.mdxindex 6b8dac164e9..14dd17d9ed5 100644--- a/packages/twenty-docs/ui/primitives/accessibility/visibility-hidden.mdx+++ b/packages/twenty-docs/ui/primitives/accessibility/visually-hidden.mdx@@ -1,17 +1,17 @@----title: VisibilityHidden+title: VisuallyHiddendescription: Keep supporting text available to assistive technology without displaying it visually.----import VisibilityHiddenReference from '/snippets/ui/generated/accessibility/visibility-hidden.mdx';+import VisuallyHiddenReference from '/snippets/ui/generated/accessibility/visually-hidden.mdx';-`VisibilityHidden` renders a visually hidden `span`. Its content stays in the accessibility tree and can supply an accessible name. It has no state and accepts only `children`.+`VisuallyHidden` renders a visually hidden `span`. Its content stays in the accessibility tree and can supply an accessible name. It accepts native span props, a span ref, and Base UI `render` composition. Import `VisuallyHiddenProps` from the same entry point.## Usage```tsximport { Button } from 'twenty-ui/primitives/input';-import { VisibilityHidden } from 'twenty-ui/primitives/accessibility';+import { VisuallyHidden } from 'twenty-ui/primitives/accessibility';import { IconPlus } from 'twenty-ui/icon';type AddRecordActionProps = { onAdd: () => void };@@ -19,7 +19,7 @@ type AddRecordActionProps = { onAdd: () => void };export const AddRecordAction = ({ onAdd }: AddRecordActionProps) => (<Button onClick={onAdd}><IconPlus aria-hidden />- <VisibilityHidden>Add record</VisibilityHidden>+ <VisuallyHidden>Add record</VisuallyHidden></Button>);```@@ -30,8 +30,8 @@ Use a visible label when space permits. For controls that already accept `aria-lPlace supporting text inside the wrapper. Avoid placing focusable controls inside it: the wrapper stays visually hidden when its children receive focus. It does not add a live region, remove content from assistive technology, or hide confidential data.-The component does not forward `id`, `className`, or other native attributes. See [accessibility](/ui/accessibility) for labeling and announcement patterns.+Use `id` to associate hidden descriptions with `aria-describedby`. Native attributes, `className`, `style`, and `ref` target the hidden span or the element supplied through `render`. See [accessibility](/ui/accessibility) for labeling and announcement patterns.## Props-<VisibilityHiddenReference />+<VisuallyHiddenReference />diff --git a/packages/twenty-docs/ui/primitives/overview.mdx b/packages/twenty-docs/ui/primitives/overview.mdxindex d550741e77f..d5bd00d370c 100644--- a/packages/twenty-docs/ui/primitives/overview.mdx+++ b/packages/twenty-docs/ui/primitives/overview.mdx@@ -88,7 +88,7 @@ Each page includes usage examples, interaction guidance, and a generated API ref| Family | Primitives || ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| Accessibility | [VisibilityHidden](/ui/primitives/accessibility/visibility-hidden) |+| Accessibility | [VisuallyHidden](/ui/primitives/accessibility/visually-hidden) || Data display | [Avatar](/ui/primitives/data-display/avatar), [Chip](/ui/primitives/data-display/chip), [ColorSample](/ui/primitives/data-display/color-sample), [Pill](/ui/primitives/data-display/pill), [Status](/ui/primitives/data-display/status), [Tag](/ui/primitives/data-display/tag) || Feedback | [Banner](/ui/primitives/feedback/banner), [Loader](/ui/primitives/feedback/loader), [ProgressBar](/ui/primitives/feedback/progress-bar), [ProgressRing](/ui/primitives/feedback/progress-ring) || Forms | [Button](/ui/primitives/input/button), [ButtonGroup](/ui/primitives/input/button-group), [Checkbox](/ui/primitives/input/checkbox), [Field](/ui/primitives/input/field), [Input](/ui/primitives/input/input), [InputGroup](/ui/primitives/input/input-group), [Radio](/ui/primitives/input/radio), [RadioGroup](/ui/primitives/input/radio-group), [SegmentedControl](/ui/primitives/input/segmented-control), [Select](/ui/primitives/input/select), [Slider](/ui/primitives/input/slider), [Switch](/ui/primitives/input/switch), [Textarea](/ui/primitives/input/textarea) |diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsxindex a0bcf2b9987..48495812686 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx@@ -1,7 +1,8 @@import { useState } from 'react';+import 'twenty-ui/style.css';import { defineFrontComponent } from 'twenty-sdk/define';import { Section } from 'twenty-ui/components/layout';-import { VisibilityHidden } from 'twenty-ui/primitives/accessibility';+import { VisuallyHiddenExample } from './visually-hidden-example';import { Button } from 'twenty-ui/primitives/input';import {Heading,@@ -72,8 +73,8 @@ const TYPOGRAPHY_ENTRIES: GalleryEntry[] = [),},{- name: 'VisibilityHidden',- node: <VisibilityHidden>Screen-reader only</VisibilityHidden>,+ name: 'VisuallyHidden',+ node: <VisuallyHiddenExample />,},];diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.tsindex baad7d0d270..67b3708036a 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts@@ -25,6 +25,24 @@ export const typographyTest: TwentyUiGalleryPlayFunction = async (context) => {);await expect(canvas.getByText('Ctrl K')).toBeVisible();+ const hiddenAction = canvas.getByRole('button', {+ name: 'Add hidden record',+ });+ const hiddenLabel = canvas.getByTitle('Hidden action label');+ expect(hiddenAction).toHaveAccessibleDescription('Creates a contact');+ expect(hiddenLabel.tagName).toBe('SPAN');+ expect(hiddenLabel).toHaveAttribute('data-composed', 'hidden-label');+ expect(hiddenLabel).toHaveAttribute('data-ref-target', 'hidden-label');+ expect(getComputedStyle(hiddenLabel).position).toBe('absolute');+ expect(hiddenLabel.getBoundingClientRect().width).toBe(1);+ expect(hiddenLabel.getBoundingClientRect().height).toBe(1);+ await userEvent.click(hiddenAction);+ await waitFor(() =>+ expect(+ canvas.getByLabelText('Hidden action activations'),+ ).toHaveTextContent('1'),+ );+const button = canvas.getByRole('button', { name: 'Edit workspace' });await userEvent.click(button);await waitFor(() =>diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/visually-hidden-example.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/visually-hidden-example.tsxnew file mode 100644index 00000000000..b4da102e8f4--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/visually-hidden-example.tsx@@ -0,0 +1,29 @@+import { useState } from 'react';+import { VisuallyHidden } from 'twenty-ui/primitives/accessibility';+import { Button } from 'twenty-ui/primitives/input';+import { Text } from 'twenty-ui/primitives/typography';++export const VisuallyHiddenExample = () => {+ const [activations, setActivations] = useState(0);++ return (+ <>+ <Button+ aria-describedby="hidden-description"+ onClick={() => setActivations((count) => count + 1)}+ >+ <VisuallyHidden+ title="Hidden action label"+ ref={(element) => {+ element?.setAttribute('data-ref-target', 'hidden-label');+ }}+ render={<span data-composed="hidden-label" />}+ >+ Add hidden record+ </VisuallyHidden>+ </Button>+ <VisuallyHidden id="hidden-description">Creates a contact</VisuallyHidden>+ <Text aria-label="Hidden action activations">{activations}</Text>+ </>+ );+};diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadTitle.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadTitle.tsxindex c04914854cd..c269267b3d7 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadTitle.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadTitle.tsx@@ -1,7 +1,7 @@import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from 'twenty-shared/utils';-import { VisibilityHidden } from 'twenty-ui/primitives/accessibility';+import { VisuallyHidden } from 'twenty-ui/primitives/accessibility';import { themeCssVariables } from 'twenty-ui/theme';import { useIsAgentChatThreadShownAsUnread } from '@/ai/hooks/useIsAgentChatThreadShownAsUnread';@@ -35,7 +35,7 @@ export const AiChatThreadTitle = ({ thread }: AiChatThreadTitleProps) => {return (<StyledTitle $isUnread={isUnread}>{isNonEmptyString(thread.title) ? thread.title : t`Untitled`}- {isUnread && <VisibilityHidden>{t`, unread`}</VisibilityHidden>}+ {isUnread && <VisuallyHidden>{t`, unread`}</VisuallyHidden>}</StyledTitle>);};diff --git a/packages/twenty-front/src/modules/onboarding/components/free-credits/OnboardingFreeCreditsProgress.tsx b/packages/twenty-front/src/modules/onboarding/components/free-credits/OnboardingFreeCreditsProgress.tsxindex 030183b3e9a..654d28b5658 100644--- a/packages/twenty-front/src/modules/onboarding/components/free-credits/OnboardingFreeCreditsProgress.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/free-credits/OnboardingFreeCreditsProgress.tsx@@ -5,7 +5,7 @@ import { StyledOnboardingFreeCreditsText } from '@/onboarding/components/free-crimport { styled } from '@linaria/react';import { plural } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';-import { VisibilityHidden } from 'twenty-ui/primitives/accessibility';+import { VisuallyHidden } from 'twenty-ui/primitives/accessibility';import { ProgressBar } from 'twenty-ui/primitives/feedback';import { themeCssVariables } from 'twenty-ui/theme';import { useIsMobile } from 'twenty-ui/utilities';@@ -65,7 +65,7 @@ export const OnboardingFreeCreditsProgress = ({<OnboardingFreeCreditsAnimatedCount credits={goalCredits} /></StyledOnboardingFreeCreditsCount>{isMobile ? (- <VisibilityHidden>{goalCreditsLabel}</VisibilityHidden>+ <VisuallyHidden>{goalCreditsLabel}</VisuallyHidden>) : (<StyledOnboardingFreeCreditsLabel>{goalCreditsLabel}diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsxindex 69fd4476bdf..b6586cc9565 100644--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx@@ -1,5 +1,5 @@import { type NavigationDrawerItemProps } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps';-import { VisibilityHidden } from 'twenty-ui/primitives/accessibility';+import { VisuallyHidden } from 'twenty-ui/primitives/accessibility';import { isObject } from '@sniptt/guards';import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';@@ -368,7 +368,7 @@ export const NavigationDrawerItem = ({<StyledItemLabel $isUnread={isUnread}>{label}{isUnread && (- <VisibilityHidden>{t`, unread`}</VisibilityHidden>+ <VisuallyHidden>{t`, unread`}</VisuallyHidden>)}</StyledItemLabel>{secondaryLabel && (diff --git a/packages/twenty-shared/src/constants/DocumentationPaths.ts b/packages/twenty-shared/src/constants/DocumentationPaths.tsindex 690e92505f1..e0020fdefa1 100644--- a/packages/twenty-shared/src/constants/DocumentationPaths.ts+++ b/packages/twenty-shared/src/constants/DocumentationPaths.ts@@ -169,8 +169,8 @@ export const DOCUMENTATION_PATHS = {UI_DARK_MODE: '/ui/dark-mode',UI_GETTING_STARTED: '/ui/getting-started',UI_ICONS: '/ui/icons',- UI_PRIMITIVES_ACCESSIBILITY_VISIBILITY_HIDDEN:- '/ui/primitives/accessibility/visibility-hidden',+ UI_PRIMITIVES_ACCESSIBILITY_VISUALLY_HIDDEN:+ '/ui/primitives/accessibility/visually-hidden',UI_PRIMITIVES_DATA_DISPLAY_AVATAR: '/ui/primitives/data-display/avatar',UI_PRIMITIVES_DATA_DISPLAY_CHIP: '/ui/primitives/data-display/chip',UI_PRIMITIVES_DATA_DISPLAY_COLOR_SAMPLE:diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex 07e751a41c2..440b69fe3f0 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -65,7 +65,7 @@ import { TAG_PROP_DESCRIPTIONS } from './tagPropDescriptions';import { DIRECTION_PROVIDER_PROP_DESCRIPTIONS } from './directionProviderPropDescriptions';import { TOOLTIP_PART_PROP_DESCRIPTIONS } from './tooltipPartPropDescriptions';import { TOOLTIP_PROP_DESCRIPTIONS } from './tooltipPropDescriptions';-import { VISIBILITY_HIDDEN_PROP_DESCRIPTIONS } from './visibilityHiddenPropDescriptions';+import { VISUALLY_HIDDEN_PROP_DESCRIPTIONS } from './visuallyHiddenPropDescriptions';export const DOCUMENTED_COMPONENTS = [{@@ -116,11 +116,11 @@ export const DOCUMENTED_COMPONENTS = [},},{- name: 'VisibilityHidden',- source: 'primitives/accessibility/components/VisibilityHidden.tsx',+ name: 'VisuallyHidden',+ source: 'primitives/accessibility/components/VisuallyHidden.tsx',entryPoint: 'twenty-ui/primitives/accessibility',- slug: 'accessibility/visibility-hidden',- propDescriptions: VISIBILITY_HIDDEN_PROP_DESCRIPTIONS,+ slug: 'accessibility/visually-hidden',+ propDescriptions: VISUALLY_HIDDEN_PROP_DESCRIPTIONS,},{name: 'ColorSample',diff --git a/packages/twenty-ui/docs/module-ownership.json b/packages/twenty-ui/docs/module-ownership.jsonindex 5dd58f5518b..56ef29665da 100644--- a/packages/twenty-ui/docs/module-ownership.json+++ b/packages/twenty-ui/docs/module-ownership.json@@ -42,7 +42,7 @@"Text","Textarea","Tooltip",- "VisibilityHidden"+ "VisuallyHidden"],"components": ["AnimatedIconCrossfade",diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.jsonindex 54e4a23f0d2..a9c4f3f5d90 100644--- a/packages/twenty-ui/docs/public-exports.json+++ b/packages/twenty-ui/docs/public-exports.json@@ -700,9 +700,11 @@"reExports": [],"values": {"handleClickableElementKeyDown": "primitives/accessibility/utils/handleClickableElementKeyDown",- "VisibilityHidden": "primitives/accessibility/components/VisibilityHidden"+ "VisuallyHidden": "primitives/accessibility/components/VisuallyHidden"},- "types": {}+ "types": {+ "VisuallyHiddenProps": "primitives/accessibility/types/VisuallyHiddenProps"+ }},"primitives/data-display": {"reExports": [],diff --git a/packages/twenty-ui/docs/visibilityHiddenPropDescriptions.ts b/packages/twenty-ui/docs/visibilityHiddenPropDescriptions.tsdeleted file mode 100644index 66c4906a214..00000000000--- a/packages/twenty-ui/docs/visibilityHiddenPropDescriptions.ts+++ /dev/null@@ -1,10 +0,0 @@-import { type ComponentProps } from 'react';--import { type VisibilityHidden } from '../src/primitives/accessibility/components/VisibilityHidden';--export const VISIBILITY_HIDDEN_PROP_DESCRIPTIONS = {- children:- 'Content hidden visually while remaining available to assistive technology.',-} satisfies Partial<- Record<keyof ComponentProps<typeof VisibilityHidden>, string>->;diff --git a/packages/twenty-ui/docs/visuallyHiddenPropDescriptions.ts b/packages/twenty-ui/docs/visuallyHiddenPropDescriptions.tsnew file mode 100644index 00000000000..eb3daf92a64--- /dev/null+++ b/packages/twenty-ui/docs/visuallyHiddenPropDescriptions.ts@@ -0,0 +1,8 @@+import { type VisuallyHiddenProps } from '../src/primitives/accessibility/types/VisuallyHiddenProps';++export const VISUALLY_HIDDEN_PROP_DESCRIPTIONS = {+ children:+ 'Content hidden visually while remaining available to assistive technology.',+ render:+ 'Element or render function composed with the hidden span props and ref.',+} satisfies Partial<Record<keyof VisuallyHiddenProps, string>>;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex e84d782ae55..c5eda1e1816 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -438,16 +438,23 @@]},{- "name": "VisibilityHidden",+ "name": "VisuallyHidden","entryPoint": "twenty-ui/primitives/accessibility",- "slug": "accessibility/visibility-hidden",+ "slug": "accessibility/visually-hidden","props": [{"name": "children","type": "ReactNode",- "required": true,+ "required": false,"defaultValue": null,"description": "Content hidden visually while remaining available to assistive technology."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Element or render function composed with the hidden span props and ref."}]},diff --git a/packages/twenty-ui/src/components/data-display/JsonTree/internal/JsonArrow.tsx b/packages/twenty-ui/src/components/data-display/JsonTree/internal/JsonArrow.tsxindex f892fef43d3..ad79c5641db 100644--- a/packages/twenty-ui/src/components/data-display/JsonTree/internal/JsonArrow.tsx+++ b/packages/twenty-ui/src/components/data-display/JsonTree/internal/JsonArrow.tsx@@ -1,6 +1,6 @@import { useJsonTreeContextOrThrow } from '@ui/components/data-display/JsonTree/internal/hooks/useJsonTreeContextOrThrow';import { IconChevronDown } from '@ui/icon';-import { VisibilityHidden } from '@ui/primitives/accessibility/components/VisibilityHidden';+import { VisuallyHidden } from '@ui/primitives/accessibility/components/VisuallyHidden';import { themeCssVariables, useTheme } from '@ui/theme';import { clsx } from 'clsx';@@ -31,9 +31,9 @@ export const JsonArrow = ({className={clsx(styles.button, variant === 'red' && styles.red)}onClick={onClick}>- <VisibilityHidden>+ <VisuallyHidden>{isOpen ? arrowButtonExpandedLabel : arrowButtonCollapsedLabel}- </VisibilityHidden>+ </VisuallyHidden><div className={styles.chevron} data-open={isOpen || undefined}><IconChevronDown size={theme.icon.size.md} color={iconColor} />diff --git a/packages/twenty-ui/src/primitives/accessibility/__stories__/VisuallyHidden.stories.tsx b/packages/twenty-ui/src/primitives/accessibility/__stories__/VisuallyHidden.stories.tsxnew file mode 100644index 00000000000..cc9eacd2e36--- /dev/null+++ b/packages/twenty-ui/src/primitives/accessibility/__stories__/VisuallyHidden.stories.tsx@@ -0,0 +1,40 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, within } from 'storybook/test';++import { IconPlus } from '@ui/icon';+import { Button } from '@ui/primitives/input/Button/Button';+import { ComponentDecorator } from '@ui/testing';++import { VisuallyHidden } from '../components/VisuallyHidden';++const meta: Meta<typeof VisuallyHidden> = {+ title: 'UI/Accessibility/VisuallyHidden',+ component: VisuallyHidden,+ decorators: [ComponentDecorator],+};++export default meta;+type Story = StoryObj<typeof VisuallyHidden>;++export const AccessibleDescription: Story = {+ render: () => {+ return (+ <>+ <Button aria-describedby="action-description">+ <IconPlus aria-hidden />+ <VisuallyHidden>Add record</VisuallyHidden>+ </Button>+ <VisuallyHidden id="action-description">+ Creates a contact+ </VisuallyHidden>+ </>+ );+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await expect(+ canvas.getByRole('button', { name: 'Add record' }),+ ).toHaveAccessibleDescription('Creates a contact');+ await expect(canvas.getByText('Add record').tagName).toBe('SPAN');+ },+};diff --git a/packages/twenty-ui/src/primitives/accessibility/__tests__/VisuallyHidden.test.tsx b/packages/twenty-ui/src/primitives/accessibility/__tests__/VisuallyHidden.test.tsxnew file mode 100644index 00000000000..264e01d10f0--- /dev/null+++ b/packages/twenty-ui/src/primitives/accessibility/__tests__/VisuallyHidden.test.tsx@@ -0,0 +1,12 @@+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import { VisuallyHidden } from '../components/VisuallyHidden';+import styles from '../components/VisuallyHidden.module.scss';++runComponentConformance({+ name: 'VisuallyHidden',+ element: <VisuallyHidden>Supporting text</VisuallyHidden>,+ ownClassName: styles.root,+ refInstanceOf: HTMLSpanElement,+ renderPropTagName: 'div',+});diff --git a/packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.tsx b/packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.tsxdeleted file mode 100644index 5e826d05651..00000000000--- a/packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.tsx+++ /dev/null@@ -1,9 +0,0 @@-import styles from './VisibilityHidden.module.scss';--export const VisibilityHidden = ({- children,-}: {- children: React.ReactNode;-}) => {- return <span className={styles.root}>{children}</span>;-};diff --git a/packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.module.scss b/packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.module.scsssimilarity index 100%rename from packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.module.scssrename to packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.module.scssdiff --git a/packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.module.scss.d.ts b/packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.module.scss.d.tssimilarity index 100%rename from packages/twenty-ui/src/primitives/accessibility/components/VisibilityHidden.module.scss.d.tsrename to packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.module.scss.d.tsdiff --git a/packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.tsx b/packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.tsxnew file mode 100644index 00000000000..785ba29f5c9--- /dev/null+++ b/packages/twenty-ui/src/primitives/accessibility/components/VisuallyHidden.tsx@@ -0,0 +1,20 @@+import { useRender } from '@base-ui/react/use-render';+import { clsx } from 'clsx';++import { type VisuallyHiddenProps } from '../types/VisuallyHiddenProps';++import styles from './VisuallyHidden.module.scss';++export const VisuallyHidden = ({+ render,+ ref,+ className,+ ...props+}: VisuallyHiddenProps) => {+ return useRender({+ defaultTagName: 'span',+ render,+ ref,+ props: { ...props, className: clsx(styles.root, className) },+ });+};diff --git a/packages/twenty-ui/src/primitives/accessibility/index.ts b/packages/twenty-ui/src/primitives/accessibility/index.tsindex 3773afc0e0f..347b9c7004e 100644--- a/packages/twenty-ui/src/primitives/accessibility/index.ts+++ b/packages/twenty-ui/src/primitives/accessibility/index.ts@@ -7,5 +7,6 @@* |___/*/-export { VisibilityHidden } from './components/VisibilityHidden';+export { VisuallyHidden } from './components/VisuallyHidden';+export type { VisuallyHiddenProps } from './types/VisuallyHiddenProps';export { handleClickableElementKeyDown } from './utils/handleClickableElementKeyDown';diff --git a/packages/twenty-ui/src/primitives/accessibility/types/VisuallyHiddenProps.ts b/packages/twenty-ui/src/primitives/accessibility/types/VisuallyHiddenProps.tsnew file mode 100644index 00000000000..24664d2c266--- /dev/null+++ b/packages/twenty-ui/src/primitives/accessibility/types/VisuallyHiddenProps.ts@@ -0,0 +1,3 @@+import { type useRender } from '@base-ui/react/use-render';++export type VisuallyHiddenProps = useRender.ComponentProps<'span'>;