spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

[Feat]: sp-number-field repopulate field after deletion

Open cdvu1 opened this issue 1 year ago • 1 comments
trafficstars

Code of conduct

  • [X] I agree to follow this project's code of conduct.

Impacted component(s)

sp-number-field

Description of the requested feature

Currently, removing the number in the number field leaves the number field blank. It would be nice if the number field could repopulate to either the previous value, or the default value (ex. 0).

Mockups or screenshots

No response

Implementation notes or ideas

No response

cdvu1 avatar Mar 01 '24 18:03 cdvu1

0 and undefined are highly different values both in javascript as well as within the context of a working application. Where there to be a "default after deleting" how would you expect a user to inform the application that undefined was the correct value?

Westbrook avatar Mar 01 '24 19:03 Westbrook

Hello @cdvu1. I discussed the idea of having a default-value for the number-field component with the team. We felt that since the number-field component is a controllable by the consuming application, having a reset to default-valuebehaviour can be easily created by listening to the @change event on the number-field component. I have added an example of the same in our doc site in this PR. Let me know if this helps :)

TarunAdobe avatar Aug 29 '24 10:08 TarunAdobe