-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Make the entire advanced mode toggle container clickable #7761
Merged
charlesBochet
merged 6 commits into
twentyhq:main
from
Vardhaman619:fix-advanced-settings-toogle
Oct 21, 2024
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fbaace5
fix: Make the entire advanced mode toggle container clickable
Vardhaman619 d9f2503
fix: spell mistake
Vardhaman619 152b3dc
Revert "fix: spell mistake"
Devessier 580bc20
Revert "fix: Make the entire advanced mode toggle container clickable"
Devessier 9961c9d
feat: improve the accessibility of the toggle component and use a lab…
Devessier debca26
refactor: remove manual forwardRef
Devessier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make the Container clickable
@Devessier what's your recommendation here ? use a button?
I feel the "Advanced" is actually a label for the toggle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for mentioning me, @charlesBochet.
Indeed, I think we should make the text "Advanced:" a true HTML
<label>
element. I don't believe the whole container should be clickable, as clicking on a blank space would update the toggle, which might seem strange.The issue is that the
<Toggle />
component is only made of<div>
and not a proper<input>
element, so using a<label>
would do nothing. I had this component on my list of accessibility things to discuss.See https://github.com/twentyhq/twenty/blob/05e8f8a0b1fd4c0b1e53c289baba3d073565b61a/packages/twenty-front/src/modules/ui/input/components/Toggle.tsx
What do you think we should do? I'm happy to discuss short-term/mid-term solutions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vardhaman619 could you update our Toggle component to include a
Take inspiration from chakra ui regarding the html structure
It looks to me that they have an invisible input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that the styles applied to hide the
input
are to make it visible only for screen readers (the tool used by people with disabilities to visit websites).These styles are now normalized and everybody uses the same to hide an element for people not using a screen reader:
Some resources :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can introduce a component in this case, let's put it in an accessibility folder in twenty-ui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chakra UI has two components : VisibilityHidden and VisibilityHiddenInput. (https://v2.chakra-ui.com/docs/components/visually-hidden/usage#visually-hidden-input)
Their VisibilityHidden component renders a
<span>
as it's usually used to provide little indications to the users, like a hidden label explaining what shows an icon.