change onClick to onFocus, with a slight delay for safari (#144)

* change onClick to onFocus, with a slight delay for safari

* typo

* fix variable name

* Fix style

---------

Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
Lauri Vuorela
2024-05-30 03:45:46 +02:00
committed by GitHub
parent 74465c0565
commit f9d915378b

View File

@@ -326,7 +326,11 @@ export function ExpenseForm({
onChange={(event) =>
onChange(enforceCurrencyPattern(event.target.value))
}
onClick={(e) => e.currentTarget.select()}
onFocus={(e) => {
// we're adding a small delay to get around safaris issue with onMouseUp deselecting things again
const target = e.currentTarget
setTimeout(() => target.select(), 1)
}}
{...field}
/>
</FormControl>