Skip to content
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
11 changes: 10 additions & 1 deletion src/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type CheckboxProps = Partial<ChildrenProps> & {

/** An accessibility label for the checkbox */
accessibilityLabel: string;

/** stop propagation of the mouse down event */
shouldStopMouseDownPropagation?: boolean;
};

function Checkbox(
Expand All @@ -60,6 +63,7 @@ function Checkbox(
caretSize = 14,
onPress,
accessibilityLabel,
shouldStopMouseDownPropagation,
}: CheckboxProps,
ref: ForwardedRef<View>,
) {
Expand Down Expand Up @@ -89,7 +93,12 @@ function Checkbox(
<PressableWithFeedback
disabled={disabled}
onPress={firePressHandlerOnClick}
onMouseDown={onMouseDown}
onMouseDown={(e) => {
if (shouldStopMouseDownPropagation) {
e.stopPropagation();
}
onMouseDown?.(e);
}}
ref={ref}
style={[StyleUtils.getCheckboxPressableStyle(containerBorderRadius + 2), style]} // to align outline on focus, border-radius of pressable should be 2px more than Checkbox
onKeyDown={handleSpaceKey}
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/Search/ReportListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ function ReportListItem<TItem extends ListItem>({
containerStyle={[StyleUtils.getCheckboxContainerStyle(20), StyleUtils.getMultiselectListStyles(!!item.isSelected, !!item.isDisabled)]}
disabled={!!isDisabled || item.isDisabledCheckbox}
accessibilityLabel={item.text ?? ''}
shouldStopMouseDownPropagation
style={[styles.cursorUnset, StyleUtils.getCheckboxPressableStyle(), item.isDisabledCheckbox && styles.cursorDisabled, !isLargeScreenWidth && styles.mr3]}
/>
)}
Expand Down