-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make the entire advanced mode toggle container clickable (#7761)
In this PR: - Use a real `<input type="checkbox" />` element in the `<Toggle />` component - Create an `accessibility` module in the `twenty-ui` package - Export the `VISIBILITY_HIDDEN` CSS object to hide visually any element - Export a `<VisibilityHidden />` component from the `twenty-ui` package to add visually hidden textual information easily - Export a `<VisibilityHiddenInput />` component to create custom form control components easily - Use a `<label>` element for the "Advanced:" text; it will naturally toggle the advanced settings Fixes #7756 --------- Co-authored-by: Devessier <baptiste@devessier.fr>
- Loading branch information
1 parent
1a0b387
commit 1466d44
Showing
7 changed files
with
68 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/twenty-ui/src/accessibility/components/VisibilityHidden.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from '@emotion/styled'; | ||
import { VISIBILITY_HIDDEN } from '@ui/accessibility/utils/visibility-hidden'; | ||
|
||
const StyledSpan = styled.span` | ||
${VISIBILITY_HIDDEN} | ||
`; | ||
|
||
export const VisibilityHidden = ({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) => { | ||
return <StyledSpan>{children}</StyledSpan>; | ||
}; |
7 changes: 7 additions & 0 deletions
7
packages/twenty-ui/src/accessibility/components/VisibilityHiddenInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import styled from '@emotion/styled'; | ||
import { VISIBILITY_HIDDEN } from '@ui/accessibility/utils/visibility-hidden'; | ||
|
||
// eslint-disable-next-line @nx/workspace-styled-components-prefixed-with-styled | ||
export const VisibilityHiddenInput = styled.input` | ||
${VISIBILITY_HIDDEN} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './components/VisibilityHidden'; | ||
export * from './components/VisibilityHiddenInput'; | ||
export * from './utils/visibility-hidden'; |
13 changes: 13 additions & 0 deletions
13
packages/twenty-ui/src/accessibility/utils/visibility-hidden.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
export const VISIBILITY_HIDDEN = css` | ||
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
padding: 0; | ||
margin: -1px; | ||
overflow: hidden; | ||
clip: rect(0, 0, 0, 0); | ||
white-space: nowrap; | ||
border-width: 0; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters