Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ehconitin
Copy link
Contributor

Screenshot 2025-01-11 at 2 55 10 PM

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 with StyledIconContainer 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

@@ -41,7 +49,12 @@ export const FavoriteFolderNavigationDrawerItemDropdown = ({
}}
data-select-disable
clickableComponent={
<LightIconButton Icon={IconDotsVertical} accent="tertiary" />
Copy link
Member

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:

  1. Define a type for ClickableAccessibilityProps that will accept:
aria-controls: string
aria-expanded: boolean
aria-haspopup: boolean
  1. Extends LightIconButton props to add the ClickableAccessibilityProps

  2. Create a FavoriteFolderNavigationDrawerItemDropdownButton.tsx that will wrap the LightIconButton and provide the 3 props to it.

  3. Use this FavoriteFolderNavigationDrawerItemDropdownButton.tsx in FavoriteFolderNavigationDrawerItemDropdown.tsx

  4. Remove these props from the container in the Dropdown.tsx component

Copy link
Member

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Devessier aria-master WDYT ?

Copy link
Contributor

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!

Copy link
Contributor

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.

https://github.com/twentyhq/twenty/pull/9560/files#diff-cde0fa86b1e8e890ce89cfb1eb0473ce7027963bc89f48168c8a885275f18f9aL137-L140

Copy link
Contributor

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?

Copy link
Member

@charlesBochet charlesBochet left a 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

@charlesBochet
Copy link
Member

@ehconitin I'm closing this PR for now, re-open it once ready :)

@ehconitin ehconitin reopened this Jan 24, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

@ehconitin ehconitin marked this pull request as draft January 24, 2025 11:57
@ehconitin
Copy link
Contributor Author

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.
When you look at where this dropdown lives, it's actually nested inside NavigationDrawerItem which renders as a . This means even if we use LightIconButton (which is also a ), we'll still get that nested button error in the console - it's not really about the Dropdown container div's aria attributes. However if you think we should get rid of dropdowns aria attribute I have tried your approach in latest changes --- but it doesn't solve the core issue of this PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 through Partial<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

Comment on lines 134 to 137
<div
ref={refs.setReference}
onClick={handleClickableComponentClick}
aria-controls={`${dropdownId}-options`}
aria-expanded={isDropdownOpen}
aria-haspopup={true}
role="button"
>
Copy link
Contributor

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.

Suggested change
<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"
>

Comment on lines +14 to +20
<LightIconButton
Icon={IconDotsVertical}
accent="tertiary"
aria-controls={`${dropdownId}-options`}
aria-expanded={isDropdownOpen}
aria-haspopup={true}
/>
Copy link
Contributor

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

Comment on lines +14 to +20
<LightIconButton
Icon={IconDotsVertical}
accent="tertiary"
aria-controls={`${dropdownId}-options`}
aria-expanded={isDropdownOpen}
aria-haspopup={true}
/>
Copy link
Contributor

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}`}
Copy link
Contributor

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

Comment on lines +1 to +7
export type ClickableAccessibilityProps = {
'aria-controls': string;

'aria-expanded': boolean;

'aria-haspopup': boolean;
};
Copy link
Contributor

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;
Copy link
Contributor

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

Comment on lines +21 to +22
} & Pick<ComponentProps<'button'>, 'aria-label' | 'title'> &
Partial<ClickableAccessibilityProps>;
Copy link
Contributor

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

@charlesBochet
Copy link
Member

charlesBochet commented Jan 24, 2025

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. When you look at where this dropdown lives, it's actually nested inside NavigationDrawerItem which renders as a . This means even if we use LightIconButton (which is also a ), we'll still get that nested button error in the console - it's not really about the Dropdown container div's aria attributes. However if you think we should get rid of dropdowns aria attribute I have tried your approach in latest changes --- but it doesn't solve the core issue of this PR

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants