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.
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.