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
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/renderer/components/inputs/elements/TabList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ export const TabList = memo(({ value, onChange, reset, isDisabled, options }: Ta
let selection = options.findIndex((o) => o.value === value);
if (selection === -1) selection = 0;

const handleChange = (index: number) => {
const selectedValue = options[index]?.value as InputSchemaValue | undefined;
if (selectedValue === undefined) {
reset();
} else {
onChange(selectedValue);
const handleTabClick = (index: number, event: React.MouseEvent) => {
if (event.button === 0) {
// Check if left mouse button was clicked
const selectedValue = options[index]?.value as InputSchemaValue | undefined;
if (selectedValue !== undefined) {
onChange(selectedValue);
}
}
};

Expand All @@ -42,7 +43,7 @@ export const TabList = memo(({ value, onChange, reset, isDisabled, options }: Ta
pt={1}
size="sm"
variant="unstyled"
onChange={handleChange}
onChange={() => {}} // Placeholder, no operation here
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
>
<ChakraTabList
borderBottom="1px solid"
Expand All @@ -57,6 +58,7 @@ export const TabList = memo(({ value, onChange, reset, isDisabled, options }: Ta
key={option}
opacity={selected ? 1 : 0.8}
px={2}
onMouseDown={(event) => handleTabClick(i, event)}
>
{option}
</Tab>
Expand Down
Loading