From 28ff5610f06fb7aae698c6fad49a0d82adb69175 Mon Sep 17 00:00:00 2001 From: Guillim Date: Tue, 10 Dec 2024 09:41:04 +0100 Subject: [PATCH] better label for toggle input that will improve UX (#8982) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Answering the ticket : Increase the clickable area of toggles to parent container # Change in Labels In order to solve this ticket, we change the way we handle the labels VS the inputs. The use of `htmlFor` and setting up the appropriate id for the toggle solves the "blank click" Screenshot 2024-12-09 at 17 43 53 fix #8953 --------- Co-authored-by: Félix Malfait --- .../components/AdvancedSettingsToggle.tsx | 11 +++---- .../menu-item/components/MenuItemToggle.tsx | 30 ++++++++++++++----- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx b/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx index efedcc756..d3532df4d 100644 --- a/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx +++ b/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx @@ -12,7 +12,7 @@ const StyledContainer = styled.div` position: relative; `; -const StyledLabel = styled.label` +const StyledText = styled.div` color: ${({ theme }) => theme.font.color.secondary}; font-size: ${({ theme }) => theme.font.size.sm}; font-weight: ${({ theme }) => theme.font.weight.medium}; @@ -25,9 +25,10 @@ const StyledIconContainer = styled.div` left: ${({ theme }) => theme.spacing(-3)}; `; -const StyledToggleContainer = styled.div` - display: flex; +const StyledToggleContainer = styled.label` align-items: center; + cursor: pointer; + display: flex; justify-content: space-between; width: 100%; `; @@ -59,8 +60,8 @@ export const AdvancedSettingsToggle = ({ fill={MAIN_COLORS.yellow} /> - - Advanced: + + Advanced: { + const inputId = useId(); return ( - - - - + + + + + + ); };