-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
minor fix -- console logs #9560
base: main
Are you sure you want to change the base?
Conversation
ehconitin
commented
Jan 11, 2025
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.
PR Summary
Simplified dropdown trigger implementation in FavoriteFolderNavigationDrawerItemDropdown by replacing LightIconButton with a custom styled container.
- Replaced
LightIconButton
withStyledIconContainer
in/packages/twenty-front/src/modules/favorites/components/FavoriteFolderNavigationDrawerItemDropdown.tsx
for more direct theme control - Added theme-based border radius and transparent background styling to maintain consistent UI appearance
- Removed unused button component imports to reduce bundle size
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
...twenty-front/src/modules/favorites/components/FavoriteFolderNavigationDrawerItemDropdown.tsx
Outdated
Show resolved
Hide resolved
@@ -41,7 +49,12 @@ export const FavoriteFolderNavigationDrawerItemDropdown = ({ | |||
}} | |||
data-select-disable | |||
clickableComponent={ | |||
<LightIconButton Icon={IconDotsVertical} accent="tertiary" /> |
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 should keep using the LightIconButton here
I think it was a mistake to add a role=button in the Dropdown.tsx component on the container div of the clickableComponent.
Instead could we:
- Define a type for ClickableAccessibilityProps that will accept:
aria-controls: string
aria-expanded: boolean
aria-haspopup: boolean
-
Extends LightIconButton props to add the ClickableAccessibilityProps
-
Create a FavoriteFolderNavigationDrawerItemDropdownButton.tsx that will wrap the LightIconButton and provide the 3 props to it.
-
Use this FavoriteFolderNavigationDrawerItemDropdownButton.tsx in FavoriteFolderNavigationDrawerItemDropdown.tsx
-
Remove these props from the container in the Dropdown.tsx component
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.
(and revert your changes here)
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.
@Devessier aria-master WDYT ?
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 tagging me. I'm checking!
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 it's great to let the clickableComponent
set these ARIA props. Currently, two elements with the button
ARIA role are nested (the div
in the Dropdown
component, and the LightIconButton
, which uses a button
HTML element and has by default the button
role). I think this is not correct.
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'm unsure if the ClickableAccessibilityProps
name relates to the expected props. To me, aria-controls
, aria-expanded
, and aria-haspopup
are more related to a popup/dropdown component.
These two components use these properties:
I'm unsure if the LightIconButton
component will always be called in a way these three ARIA attributes must be set. The ARIA attributes to set depend on the context where the component is used. I think these properties should all be optional, and we could transform the ClickableAccessibilityProps
type into a more generic AriaProps
:
import { AriaAttributes, AriaRole } from 'react';
type AriaProps =
| AriaAttributes
| {
role: AriaRole;
};
I'm not sure about the right level of abstraction here. We should ensure it doesn't become a foot gun. The first lesson of any accessibility course is that using no ARIA attributes is better than misusing them, which can make the UX even worse for people using screen readers.
What do you think?
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 @ehconitin
I think we should go for a different approach, see my comment
@ehconitin I'm closing this PR for now, re-open it once ready :) |
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.
PR Summary
(updates since last review)
This PR reorders CSS properties in the StyledIconContainer component, moving 'display: flex' before 'justify-content: center' for better code organization.
- Reordered CSS properties in
/packages/twenty-front/src/modules/favorites/components/FavoriteFolderNavigationDrawerItemDropdown.tsx
for improved readability
Note: Since this is a minor cosmetic change to CSS property ordering with no functional impact, and the previous review already covered the major component changes, there are no other significant points to highlight.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Hi @charlesBochet - just want to clear something up. I noticed you're focused on keeping LightIconButton because of design consistency (which makes sense), but I think you might have missed my earlier point about NavigationDrawerItem being a button itself. |
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.
PR Summary
(updates since last review)
This PR removes essential ARIA accessibility attributes from the Dropdown component while introducing new accessibility-related types and structures.
- Removed critical ARIA attributes (
aria-controls
,aria-expanded
,aria-haspopup
) from clickable div in/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx
- Added new
ClickableAccessibilityProps
type in/packages/twenty-ui/src/accessibility/types/ClickableAccessibilityProps.ts
for standardizing accessibility props - Extended
LightIconButton
in/packages/twenty-ui/src/input/button/components/LightIconButton.tsx
to support ARIA attributes throughPartial<ClickableAccessibilityProps>
Note: The removal of ARIA attributes from the Dropdown component should be reverted to maintain accessibility standards.
7 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile
<div | ||
ref={refs.setReference} | ||
onClick={handleClickableComponentClick} | ||
aria-controls={`${dropdownId}-options`} | ||
aria-expanded={isDropdownOpen} | ||
aria-haspopup={true} | ||
role="button" | ||
> |
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.
logic: Removing ARIA attributes breaks accessibility. The clickable div needs aria-controls
, aria-expanded
, aria-haspopup
, and role='button'
for screen reader support.
<div | |
ref={refs.setReference} | |
onClick={handleClickableComponentClick} | |
aria-controls={`${dropdownId}-options`} | |
aria-expanded={isDropdownOpen} | |
aria-haspopup={true} | |
role="button" | |
> | |
<div | |
ref={refs.setReference} | |
onClick={handleClickableComponentClick} | |
aria-controls={`${dropdownId}-options`} | |
aria-expanded={isDropdownOpen} | |
aria-haspopup={true} | |
role="button" | |
> |
<LightIconButton | ||
Icon={IconDotsVertical} | ||
accent="tertiary" | ||
aria-controls={`${dropdownId}-options`} | ||
aria-expanded={isDropdownOpen} | ||
aria-haspopup={true} | ||
/> |
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.
logic: missing aria-label for screen readers to identify this button's purpose
<LightIconButton | ||
Icon={IconDotsVertical} | ||
accent="tertiary" | ||
aria-controls={`${dropdownId}-options`} | ||
aria-expanded={isDropdownOpen} | ||
aria-haspopup={true} | ||
/> |
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.
logic: missing onClick handler - button currently has no interaction capability
@@ -41,7 +38,10 @@ export const FavoriteFolderNavigationDrawerItemDropdown = ({ | |||
}} | |||
data-select-disable | |||
clickableComponent={ | |||
<LightIconButton Icon={IconDotsVertical} accent="tertiary" /> | |||
<FavoriteFolderNavigationDrawerItemDropdownButton | |||
dropdownId={`favorite-folder-edit-${folderId}`} |
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.
style: dropdownId prop is redundant here since it's already being used on line 35
export type ClickableAccessibilityProps = { | ||
'aria-controls': string; | ||
|
||
'aria-expanded': boolean; | ||
|
||
'aria-haspopup': boolean; | ||
}; |
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.
style: Consider making these props optional with '?' since not all clickable elements will need all three ARIA attributes. Some buttons may only need aria-expanded without aria-controls.
|
||
'aria-expanded': boolean; | ||
|
||
'aria-haspopup': boolean; |
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.
logic: aria-haspopup should accept boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' according to ARIA spec
} & Pick<ComponentProps<'button'>, 'aria-label' | 'title'> & | ||
Partial<ClickableAccessibilityProps>; |
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.
logic: making ClickableAccessibilityProps partial means aria-controls, aria-expanded, and aria-haspopup will be optional, which could lead to incomplete accessibility implementation in consuming components
I still think #9560 (comment) is the right approach, why don't it work? Edit: you actually implemented it, I'm taking a deep look tonight |