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

fix(conditionBuilder): address issues inside conditionBuilder popover #6421

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export const ItemOption = ({
);
};

const preventDefault = (evt) => evt.preventDefault();

if (!allOptions) {
return;
}
Expand All @@ -99,7 +97,6 @@ export const ItemOption = ({
labelText={clearSearchText}
closeButtonLabelText={clearSearchText}
onChange={onSearchChangeHandler}
onKeyDown={preventDefault}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@
} else {
onChange(option, evt);
}
if (evt.target instanceof SVGElement) {
evt.stopPropagation();

Check warning on line 149 in packages/ibm-products/src/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ibm-products/src/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.tsx#L149

Added line #L149 was not covered by tests
//stop propagate event , since this closes the popover when clicked on checkboxes which are SVGs.
}
};

const getAriaLabel = () => {
Expand All @@ -154,7 +158,6 @@
? conditionState.property
: propertyText;
};
const preventDefault = (evt) => evt.preventDefault();

if (!allOptions) {
return <SelectSkeleton />;
Expand All @@ -168,7 +171,6 @@
labelText={clearSearchText}
closeButtonLabelText={clearSearchText}
onChange={onSearchChangeHandler}
onKeyDown={preventDefault}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ export const sampleDataStructure_nonHierarchical = {
operator: 'oneOf',
value: [
{
label: 'Africa',
id: 'Africa',
label: 'Afghanistan',
id: 'AF',
},
{
label: { id: 'India', label: 'India' },
id: 'Ind',
label: 'Albania',
id: 'AL',
},
],
id: uuidv4(),
Expand Down
Loading