You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/components/parts/InputNumberLocaled.svelte
+15-8Lines changed: 15 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,20 @@ Two things are enhanced:
62
62
if (actualInputUI) actualInputUI.focus();
63
63
whenFocused=true;
64
64
}
65
+
66
+
const onBlur = (e:Event) => {
67
+
whenFocused=false;
68
+
69
+
// to ignore window itself get blurred - somehow not progressing to below prevents element's being invisible
70
+
if (document.activeElement===e.target) {
71
+
return;
72
+
}
73
+
74
+
// tidy the input text to reflect the calculated value
75
+
if (actualInputUI) {
76
+
actualInputUI.value=integer.toString();
77
+
}
78
+
};
65
79
</script>
66
80
67
81
<!-- inspired by https://github.com/yairEO/react-number-input but with a different approach of using two input tags instead of manipulating the text -->
@@ -92,14 +106,7 @@ Two things are enhanced:
92
106
on:focus={() => {
93
107
whenFocused=true;
94
108
}}
95
-
on:blur={() => {
96
-
whenFocused=false;
97
-
98
-
// tidy the input text to reflect the calculated value
0 commit comments