Calling blur on a Dom element

I’m stuck trying to figure out how to call .blur() on a Dom.element :thinking:
Do you know how do this?

I hacked my own util like this:

@send external blur: Dom.element => unit = "blur"

But there’s probably a better way to achieve this?

ReScript doesn’t provide bindings for the full DOM API out of the box. From the docs:

The Dom module offers a canonical set of dom related types that third party libraries can depend on. It only provides types, no functions to manipulate the values of certain types whatsoever.

For some apps writing your own bindings, as you are doing, is a good way to go. Another option is to pull in rescript-webapi as a dependency. You could also vendor some of these bindings if you didn’t want an external dependency

Of course each of these solutions have trade offs, there isn’t a one size fits all answer


Thanks @tom-sherman just the type of answer I was looking for.