Repository: GraphiteEditor/Graphite (language: rust)

Issue:
In Firefox, tool control bar number input field dragging causes text entry afterward
This only happens in Firefox which likely means it is a result of event ordering. Events that happen at the same time (such as `click` and `mouseup` and `pointerup`) don't get fired in the same order in FF as in Chrome. This has caused problems in the past. The solution is tracing the logic and then updating it to be more robust to either ordering. This is a sizable chance that some of the debugging will take place in the Rust code, not just `NumberInput.svelte` and other frontend code.

For only the tool control bar (the left side of the control bar, above the viewport), if you drag left/right on number input boxes (such as "Diameter" for the Brush tool, "Weight" for any of the vector drawing tools, also the Polygon and Text tool's various number inputs, but apparently **not** the "X"/"Y" point position of the Path tool). It doesn't seem to happen for any other number inputs throughout the editor from what I could find, even those on the right side of the control bar.

![Image](https://github.com/user-attachments/assets/8b25bc1a-b079-4609-85ba-9332568dc58a)


Discussion / hints:
@Keavon  can i work on this issue?
@prathmesh703 Sure thing!

Fix patch:
diff --git a/frontend/src/components/widgets/inputs/NumberInput.svelte b/frontend/src/components/widgets/inputs/NumberInput.svelte
index 0c4c2280c0..08b75a5ef4 100644
--- a/frontend/src/components/widgets/inputs/NumberInput.svelte
+++ b/frontend/src/components/widgets/inputs/NumberInput.svelte
@@ -59,6 +59,7 @@
 	let self: FieldInput | undefined;
 	let inputRangeElement: HTMLInputElement | undefined;
 	let text = displayText(value, unit);
+	let isDragging = false;
 	let editing = false;
 	// Stays in sync with a binding to the actual input range slider element.
 	let rangeSliderValue = value !== undefined ? value : 0;
@@ -187,6 +188,8 @@
 		editing = true;
 
 		self?.selectAllText(text);
+		// Workaround for weird behavior in Firefox: <https://github.com/GraphiteEditor/Graphite/issues/2215>
+		if (isDragging) self?.unFocus();
 	}
 
 	// Called only when `value` is changed from the <input> element via user input and committed, either with the
@@ -281,7 +284,7 @@
 		const onMove = () => {
 			if (alreadyActedGuard) return;
 			alreadyActedGuard = true;
-
+			isDragging = true;
 			beginDrag(e);
 			removeEventListener("pointermove", onMove);
 		};
@@ -289,7 +292,7 @@
 		const onUp = () => {
 			if (alreadyActedGuard) return;
 			alreadyActedGuard = true;
-
+			isDragging = false;
 			self?.focus();
 			removeEventListener("pointerup", onUp);
 		};


Test patch: