Skip to content

Commit 3cfcec3

Browse files
committed
lint
1 parent 83c23dc commit 3cfcec3

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

packages/react/src/number-field/scrub-area/NumberFieldScrubArea.tsx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import * as React from 'react';
33
import * as ReactDOM from 'react-dom';
44
import { ownerWindow, ownerDocument } from '@base-ui-components/utils/owner';
5-
import { isWebKit } from '@base-ui-components/utils/detectBrowser';
6-
import { useValueAsRef } from '@base-ui-components/utils/useValueAsRef';
5+
import { isFirefox, isWebKit } from '@base-ui-components/utils/detectBrowser';
76
import { useStableCallback } from '@base-ui-components/utils/useStableCallback';
87
import { useTimeout } from '@base-ui-components/utils/useTimeout';
98
import type { BaseUIComponentProps, HTMLProps } from '../../utils/types';
@@ -44,7 +43,6 @@ export const NumberFieldScrubArea = React.forwardRef(function NumberFieldScrubAr
4443
setIsScrubbing,
4544
disabled,
4645
readOnly,
47-
value,
4846
inputRef,
4947
incrementValue,
5048
getStepAmount,
@@ -53,8 +51,6 @@ export const NumberFieldScrubArea = React.forwardRef(function NumberFieldScrubAr
5351
valueRef,
5452
} = useNumberFieldRootContext();
5553

56-
const latestValueRef = useValueAsRef(value);
57-
5854
const scrubAreaRef = React.useRef<HTMLSpanElement>(null);
5955

6056
const isScrubbingRef = React.useRef(false);
@@ -149,21 +145,20 @@ export const NumberFieldScrubArea = React.forwardRef(function NumberFieldScrubAr
149145
let cumulativeDelta = 0;
150146

151147
function handleScrubPointerUp(event: PointerEvent) {
152-
try {
153-
// Avoid errors in testing environments.
154-
// Firefox needs a small delay here when soft-clicking as the pointer
155-
// lock will not release otherwise.
156-
exitPointerLockTimeout.start(20, () => {
148+
// Firefox needs a small delay here when soft-clicking as the pointer
149+
// lock will not release otherwise.
150+
exitPointerLockTimeout.start(isFirefox ? 20 : 0, () => {
151+
try {
157152
ownerDocument(scrubAreaRef.current).exitPointerLock();
158-
});
159-
} finally {
160-
isScrubbingRef.current = false;
161-
onScrubbingChange(false, event);
162-
onValueCommitted(
163-
lastChangedValueRef.current ?? valueRef.current,
164-
createGenericEventDetails(REASONS.scrub, event),
165-
);
166-
}
153+
} finally {
154+
isScrubbingRef.current = false;
155+
onScrubbingChange(false, event);
156+
onValueCommitted(
157+
lastChangedValueRef.current ?? valueRef.current,
158+
createGenericEventDetails(REASONS.scrub, event),
159+
);
160+
}
161+
});
167162
}
168163

169164
function handleScrubPointerMove(event: PointerEvent) {
@@ -210,9 +205,8 @@ export const NumberFieldScrubArea = React.forwardRef(function NumberFieldScrubAr
210205
[
211206
disabled,
212207
readOnly,
213-
isScrubbing,
214208
incrementValue,
215-
latestValueRef,
209+
isScrubbing,
216210
getStepAmount,
217211
inputRef,
218212
onScrubbingChange,

0 commit comments

Comments
 (0)