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

issue #2734 fixed #2792

Merged
merged 5 commits into from
Apr 14, 2024
Merged

issue #2734 fixed #2792

merged 5 commits into from
Apr 14, 2024

Conversation

RaySit
Copy link
Contributor

@RaySit RaySit commented Apr 14, 2024

Changes to 'TabList' Component Behavior

Modification Overview:
This update modifies how tab changes are handled in the 'TabList' component to ensure that tab switching only occurs with left mouse clicks.

Key Changes:

  1. Removal of Redundant 'onChange': The 'onChange' prop of the 'Tabs' component was found to be redundant because tab change handling is now customized. It has been replaced with a placeholder function to maintain the component structure without performing any operation.
  2. Conditional Tab Switching: Introduced a 'handleTabClick' function that is triggered on the onMouseDown event. This function checks if the left mouse button ('event.button === 0') was clicked before changing the tab. This prevents unintended tab switches from right-clicks or middle-clicks.
  3. Efficient Event Handling: By using the 'onMouseDown' event directly on each 'Tab', the tab-switching logic is more directly controlled and can be easily extended or modified to include additional conditions or behaviors.

Screenshot demonstrating right-clicking a tab:
The user node menu is brought out as normal, but the tab is not switched.
Screenshot 2024-04-13 at 21 35 07

Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Thank you for the work @RaySit!

Just one minor nit, and then this is good to go.

src/renderer/components/inputs/elements/TabList.tsx Outdated Show resolved Hide resolved
@RunDevelopment RunDevelopment linked an issue Apr 14, 2024 that may be closed by this pull request
Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Thank you @RaySit!

Copy link
Member

@joeyballentine joeyballentine left a comment

Choose a reason for hiding this comment

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

Thanks! (And thanks to your professor for having open source contribution as part of your final project 😄)

@joeyballentine joeyballentine merged commit d0a1351 into chaiNNer-org:main Apr 14, 2024
4 checks passed
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.

Tab UI elements can be clicked with any mouse button
3 participants