Fix hover transfer bugs occurring with the color picker popover (#4146)

* Fix hover transfer bugs occurring with the color picker popover

* Code review fix
This commit is contained in:
Keavon Chambers
2026-05-13 20:19:56 -07:00
committed by GitHub
parent 4d5dce976e
commit 696b625a3e
5 changed files with 25 additions and 23 deletions
@@ -40,10 +40,16 @@
// The `unFocus()` call in `onTextChangeCanceled()` causes itself to be run again, so this if statement skips a second run
if (!editing) return;
// Capture before `onTextChangeCanceled` blurs the input
const currentValue = self?.getValue();
onTextChangeCanceled();
// TODO: Find a less hacky way to do this
if (self) dispatch("commitText", self.getValue());
// Only commit on a real edit, so a blur fired when the focused input is removed from the DOM (e.g., from a picker closing
// during hover transfer) doesn't round-trip the original value back to the backend and overwrite concurrent state.
if (self && currentValue !== undefined && currentValue !== value) {
dispatch("commitText", currentValue);
}
// Required if value is not changed by the parent component upon update:value event
self?.setInputElementValue(self.getValue());