tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3.05k stars 255 forks source link

Submit input field when pressing Return #1537

Closed jotaen4tinypilot closed 1 year ago

jotaen4tinypilot commented 1 year ago

Community-specific part of https://github.com/tiny-pilot/tinypilot/issues/897. Users can now submit a new hostname by pressing the “Return” key.

It seems that the Element.click() method is exactly what we need in terms of behaviour, and I thought it made more sense to make the implementation so that it “delegates” to the button click-handler, rather than repeating the internal logic of the latter.

To me, the event handler would be expressive and straightforward enough to be inlined.

I also added a brief explanation in the style guide, to capture our intent. Review on CodeApprove