fast icon indicating copy to clipboard operation
fast copied to clipboard

feat(text-field): reset value on type change

Open 43081j opened this issue 9 months ago • 2 comments

This changes fast-text-field to reset its value any time type changes.

The reason for this is that switching between two incompatible input types may reset the inner control's value, which won't otherwise be reflected to the outer element.

For example, using type="text" and typing a value into the input, then changing to type="number". This should reset the value, since the inner control will have already done so.

🎫 Issues

Fixes #6827

👩‍💻 Reviewer Notes

In material, this is solved by resetting the value any time the component's properties change at all. Maybe we should do the same here? I just wasn't sure if there's a lifecycle callback in FAST for when any properties change.

I'm also not too sure the test I've added is consistent with how you usually test this stuff. I didn't see any other tests testing the members of the element itself, only via attributes.

If you want to solve this another way, let me know and I'm happy to update.

📑 Test Plan

Added a new test for changing type after input has occurred.

✅ Checklist

General

  • [x] I have included a change request file using $ yarn change
  • [x] I have added tests for my changes.
  • [x] I have tested my changes.
  • [ ] I have updated the project documentation to reflect my changes.
  • [x] I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

43081j avatar Sep 18 '23 21:09 43081j