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: invalid touchable area on mobile browser #4514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
180 changes: 91 additions & 89 deletions src/components/FAB/FABGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,100 +358,102 @@ const FABGroup = ({
]}
/>
<View pointerEvents="box-none" style={styles.safeArea}>
<View pointerEvents={open ? 'box-none' : 'none'}>
{actions.map((it, i) => {
const labelTextStyle = {
color: it.labelTextColor ?? labelColor,
...(isV3 ? theme.fonts.titleMedium : {}),
};
const marginHorizontal =
typeof it.size === 'undefined' || it.size === 'small' ? 24 : 16;
const accessibilityLabel =
typeof it.accessibilityLabel !== 'undefined'
? it.accessibilityLabel
: it.label;
const size = typeof it.size !== 'undefined' ? it.size : 'small';
{open && (
<View pointerEvents={open ? 'box-none' : 'none'}>
{actions.map((it, i) => {
const labelTextStyle = {
color: it.labelTextColor ?? labelColor,
...(isV3 ? theme.fonts.titleMedium : {}),
};
const marginHorizontal =
typeof it.size === 'undefined' || it.size === 'small' ? 24 : 16;
const accessibilityLabel =
typeof it.accessibilityLabel !== 'undefined'
? it.accessibilityLabel
: it.label;
const size = typeof it.size !== 'undefined' ? it.size : 'small';

return (
<View
key={i} // eslint-disable-line react/no-array-index-key
style={[
styles.item,
{
marginHorizontal,
},
]}
pointerEvents={open ? 'box-none' : 'none'}
accessibilityRole="button"
importantForAccessibility="yes"
accessible={true}
accessibilityLabel={accessibilityLabel}
>
{it.label && (
<View>
<Card
mode={isV3 ? 'contained' : 'elevated'}
onPress={(e) => {
it.onPress(e);
close();
}}
accessibilityHint={it.accessibilityHint}
importantForAccessibility="no-hide-descendants"
accessibilityElementsHidden={true}
style={[
styles.containerStyle,
{
transform: [
isV3
? { translateY: labelTranslations[i] }
: { scale: scales[i] },
],
opacity: opacities[i],
},
isV3 && styles.v3ContainerStyle,
it.containerStyle,
]}
>
<Text
variant="titleMedium"
importantForAccessibility="no-hide-descendants"
accessibilityElementsHidden={true}
style={[labelTextStyle, it.labelStyle]}
maxFontSizeMultiplier={it.labelMaxFontSizeMultiplier}
>
{it.label}
</Text>
</Card>
</View>
)}
<FAB
size={size}
icon={it.icon}
color={it.color}
return (
<View
key={i} // eslint-disable-line react/no-array-index-key
style={[
styles.item,
{
transform: [{ scale: scales[i] }],
opacity: opacities[i],
backgroundColor: stackedFABBackgroundColor,
marginHorizontal,
},
isV3 && { transform: [{ translateY: translations[i] }] },
it.style,
]}
accessibilityElementsHidden={true}
theme={theme}
onPress={(e) => {
it.onPress(e);
close();
}}
importantForAccessibility="no-hide-descendants"
testID={it.testID}
visible={open}
rippleColor={it.rippleColor}
/>
</View>
);
})}
</View>
pointerEvents={open ? 'box-none' : 'none'}
accessibilityRole="button"
importantForAccessibility="yes"
accessible={true}
accessibilityLabel={accessibilityLabel}
>
{it.label && (
<View>
<Card
mode={isV3 ? 'contained' : 'elevated'}
onPress={(e) => {
it.onPress(e);
close();
}}
accessibilityHint={it.accessibilityHint}
importantForAccessibility="no-hide-descendants"
accessibilityElementsHidden={true}
style={[
styles.containerStyle,
{
transform: [
isV3
? { translateY: labelTranslations[i] }
: { scale: scales[i] },
],
opacity: opacities[i],
},
isV3 && styles.v3ContainerStyle,
it.containerStyle,
]}
>
<Text
variant="titleMedium"
importantForAccessibility="no-hide-descendants"
accessibilityElementsHidden={true}
style={[labelTextStyle, it.labelStyle]}
maxFontSizeMultiplier={it.labelMaxFontSizeMultiplier}
>
{it.label}
</Text>
</Card>
</View>
)}
<FAB
size={size}
icon={it.icon}
color={it.color}
style={[
{
transform: [{ scale: scales[i] }],
opacity: opacities[i],
backgroundColor: stackedFABBackgroundColor,
},
isV3 && { transform: [{ translateY: translations[i] }] },
it.style,
]}
accessibilityElementsHidden={true}
theme={theme}
onPress={(e) => {
it.onPress(e);
close();
}}
importantForAccessibility="no-hide-descendants"
testID={it.testID}
visible={open}
rippleColor={it.rippleColor}
/>
</View>
);
})}
</View>
)}
<FAB
onPress={(e) => {
onPress?.(e);
Expand Down