angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

fix(input): update $viewValue when cleared

Open wesleycho opened this issue 9 years ago • 9 comments

  • Fix when user clicks clear button in an input element in IE, $viewValue not being correctly updated

This should fix #11193.

wesleycho avatar Jun 14 '16 15:06 wesleycho

Cool! I believe writing a test is difficult because we can't click the clear button?

Narretz avatar Jun 14 '16 15:06 Narretz

Yeah - fussing around with this a bit to get the right condition currently, but I think the right fix might be attainable here.

wesleycho avatar Jun 14 '16 15:06 wesleycho

This is a little tough - so falsy model changes will convert to the empty string, so this potentially breaks some behavior. Any ideas on good workarounds for that situation?

wesleycho avatar Jun 14 '16 16:06 wesleycho

There are some complicated scenarios I'm having trouble figuring out a good solution to.

Here is an incomplete table:

Initial view value Initial model value View value after view change Model value after model change Erroneous IE input events Run $parsers/$validators
'' undefined '' N/A false true
'' null '' N/A false true
'' null N/A '' false true
'' undefined N/A N/A true false

wesleycho avatar Jun 14 '16 17:06 wesleycho

Wouldn't it be easier to just add an extra listener on IEs:

element.on('??mousedown/mouseup/click??', function(event) {
  deferListener(event, this, this.value);
});

gkalpak avatar Jun 15 '16 10:06 gkalpak

@wesleycho Do you still want to work on this?

Narretz avatar Oct 07 '16 20:10 Narretz

Don't have the bandwidth anymore :( .

wesleycho avatar Oct 07 '16 20:10 wesleycho

What's the status on this issue (not doubt i'm not the only one encountering this) Thanks

blemaire avatar Jun 08 '18 13:06 blemaire

It has been abandoned (afaict) :grin: If anyone wants to take it over, we will be more than happy to offer guidance and reviews, but I don't think we have the resources to take it over, given that we have less than a month of active feature development before entering LTS.

gkalpak avatar Jun 08 '18 15:06 gkalpak