gaucho-labs / leptos-hotkeys

a declarative way of using keyboard shortcuts + callbacks in leptos applications
https://leptos-hotkeys.vercel.app
MIT License
43 stars 8 forks source link

The argument `allow_blur_event` is a confusing boolean trap #87

Open mondeja opened 5 months ago

mondeja commented 5 months ago

This is a common case of a boolean trap, a software antipattern. It could be defined as a boolean trap, but at least a positive name should be expected to take action. His name is now so much confusing.

Currently, defining allow_blur_event to false in the call to provide_hotkeys_context will create a blur event on the windows object. Means something like: "if not allow blur event then create a blur event to reset all the active scopes", that doesn't makes sense.

Their name should be somehing like reset_pressed_keys_on_blur and should accept a true value to enable it.

I think that this can be implemented along with #84 and postponed to v0.3.0.