Perspective Text Field bidirectional binding corner case bug

Weird corner case I just bumped into while testing some code to sanitize user input:

  • Setup a Text Field in a Perspective view with a bidirectional binding on it’s text property from another view property
  • Enter some text like xxx in the box and see the bound property is updated as expected when the text field loses focus (:+1:)
  • Click back on the text field and add some whitespace at the beginning/end of the string (i.e. xxx ), and the bound property is NOT updated when the text field loses focus even thought the text property on the text field component is updated (:-1:)
  • Go back to the text field and change any of the x characters, and the bound property is updated with the new value including beginning/end whitespace when the text field loses focus (:+1:)

Seems to me that even though the bidirectional binding will copy the leading/trailing whitespace, the logic that decides “has the value changed to trigger the binding” ignores changes in leading/trailing whitespace.

I feel like it shouldn’t be possible to get a bidirectionally bound pair of properties out of sync like that. This seems to require the Perspective Text Field to happen. I couldn’t make a similar failure happen between two properties that were not part of a text field.

Saw this on 8.1.13.

I’m not able to readily reproduce on 8.1.17; maybe this is a bug we fixed?

Just tried that setup in 8.1.13 and it also works for me.
Lemme try if I can narrow down what is different.

Never mind. I’m dumb.

It was a side effect of the way my sanitizing script was behaving. I was sure I had disabled it, but I hadn’t.

We’re good. Thanks for the super quick response.

1 Like