Skip to content

fix: move onClick handlers from Avatar to ButtonBase for keyboard accessibility#5845

Closed
fuleinist wants to merge 1 commit intoFlowiseAI:mainfrom
fuleinist:fix/keyboard-accessibility-canvas-buttons
Closed

fix: move onClick handlers from Avatar to ButtonBase for keyboard accessibility#5845
fuleinist wants to merge 1 commit intoFlowiseAI:mainfrom
fuleinist:fix/keyboard-accessibility-canvas-buttons

Conversation

@fuleinist
Copy link

Description

Fixes #5819: Misplaced click event in chat flow window

This PR moves the onClick event handlers from the Avatar components to their parent ButtonBase components for 4 buttons in the canvas header:

  • Edit Name
  • API Endpoint
  • Save
  • Settings

Problem

The click events were bound to the Avatar (which renders as a div), making these buttons non-functional when activated via keyboard (Enter or Space key). This is an accessibility issue that prevents keyboard-only users and screen reader users from interacting with these buttons.

Solution

Move the onClick handler from the child Avatar element to the parent ButtonBase element, which is a proper button element that responds to keyboard interactions.

Testing

  1. Go to chat flows
  2. Click add new chat flow, add a node
  3. Focus the Save button using the keyboard (Tab)
  4. Press Enter or Space
  5. The click event should now trigger

Accessibility

This fix is particularly important for keyboard-only users and screen reader users, as noted in the original issue report.

…essibility

- Fixes FlowiseAI#5819: Misplaced click event in chat flow window
- Moves onClick from Avatar to ButtonBase for 4 buttons:
  - Edit Name
  - API Endpoint
  - Save
  - Settings
- Enables keyboard users (Enter/Space) to trigger these buttons
- Important accessibility fix for keyboard-only and screen reader users
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fuleinist, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical accessibility concern by refactoring how click events are handled for key interactive elements within the canvas header. By relocating event listeners from non-interactive Avatar elements to their interactive ButtonBase parents, the change significantly enhances the user experience for keyboard-only users and screen reader users, making the application more inclusive and compliant with accessibility standards.

Highlights

  • Accessibility Fix: Resolved an accessibility issue where four buttons in the canvas header were not keyboard accessible due to misplaced click event handlers.
  • Event Handler Relocation: Moved onClick event handlers from Avatar components to their parent ButtonBase components for the 'Edit Name', 'API Endpoint', 'Save', and 'Settings' buttons.
  • Improved Keyboard Interaction: Ensured that these buttons now correctly respond to keyboard interactions (Enter or Space key) by binding events to the semantically correct ButtonBase elements.
Changelog
  • packages/ui/src/views/canvas/CanvasHeader.jsx
    • Moved onClick handler for 'Edit Name' functionality from Avatar to ButtonBase.
    • Moved onClick handler for 'API Endpoint' functionality from Avatar to ButtonBase.
    • Moved onClick handler for 'Save' functionality from Avatar to ButtonBase.
    • Moved onClick handler for 'Settings' functionality from Avatar to ButtonBase.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an accessibility issue by moving onClick handlers from Avatar components to their parent ButtonBase components. While the changes made are correct, the fix is incomplete. I've identified several other buttons within the same component that were not updated and still follow the inaccessible pattern. My review comment provides details on these missed instances. Applying the fix consistently across the entire component is necessary to fully resolve the accessibility issue.

{chatflow?.id && (
<Available permission={savePermission}>
<ButtonBase title='Edit Name' sx={{ borderRadius: '50%' }}>
<ButtonBase title='Edit Name' sx={{ borderRadius: '50%' }} onClick={() => setEditingFlowName(true)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While this change correctly improves keyboard accessibility for this button, the fix is incomplete. Several other buttons in this component still have the onClick handler on the Avatar instead of the ButtonBase. To fully address the accessibility issue, please apply the same fix to the following buttons:

  • 'Back' button (lines 256-281)
  • 'Save Name' button (lines 343-363)
  • 'Cancel' button (lines 364-384)

@fuleinist
Copy link
Author

Superseded by complete fix in #5846 which addresses all 7 buttons in the canvas header.

@fuleinist fuleinist closed this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misplaced click event in chat flow window

2 participants