Skip to content

Commit 8f77f26

Browse files
authored
Merge pull request #38 from claytercek/drag-threshold
add dragThreshold prop to A11y component
2 parents 225f58e + 976a906 commit 8f77f26

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/A11y.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface A11yCommonProps {
1515
debug?: boolean;
1616
a11yElStyle?: Object;
1717
hidden?: boolean;
18+
dragThreshold?: number;
1819
}
1920

2021
type RoleProps =
@@ -102,6 +103,7 @@ export const A11y: React.FC<Props> = ({
102103
startPressed = false,
103104
tag = 'p',
104105
hidden = false,
106+
dragThreshold,
105107
...props
106108
}) => {
107109
let constHiddenButScreenreadable = Object.assign(
@@ -460,7 +462,7 @@ export const A11y: React.FC<Props> = ({
460462
{...props}
461463
onClick={e => {
462464
e.stopPropagation();
463-
if (disabled) {
465+
if (disabled || (dragThreshold && e.delta > dragThreshold)) {
464466
return;
465467
}
466468
if (role === 'button') {

0 commit comments

Comments
 (0)