mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 03:58:12 +08:00
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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user