Doist / reactist

Open source React components made with ❤️ by Doist
http://doist.github.io/reactist
MIT License
248 stars 22 forks source link

fix: Fixes to the startIcon feature on TextField #769

Closed gnapse closed 1 year ago

gnapse commented 1 year ago

Short description

While attempting to look into adding a new feature to the TextField[^1], I noticed a couple of issues with the text field startIcon:

  1. The "click to focus" functionality was still not entirely accurate if one managed to click on the thin padding around the icon. This PR fixes it by capturing the click event on the input element wrapper that covers the entire area inside the borders.
  2. The startIcon feature was tailored only for the default text field variant. When the text field was set in bordered mode, the icon placement does not look good.

[^1]: The new feature I'm looking into is related to enabling the text field to also have a slot on the right side, similar to the one for startIcon. However, the slot in question is for more than just icons. It's about enabling the text field to have a button on its right side, for instance. Anyway, this PR is not at all about that.

PR Checklist

Versioning

Patch release

Demo

BeforeAfter
CleanShot 2023-05-08 at 08 00 48@2x CleanShot 2023-05-08 at 07 58 38@2x