The commit behavior of the PropertyPane editor needs some modifications #915
Labels
bug
Something isn't working
presentation
Issues that @itwin/itwinjs-core-presentation team is going to work on
Describe the bug
When a commit is triggered from the UI, the component will propagate the change event even if the 'backing' value is exactly the same. This results in a transaction on the undo stack when a user simply enters edit mode and then clicks off (changes nothing). Also the ESC key seems to commit, which it should not.
To Reproduce
No response
Expected Behavior
The ESC key should be an easy one. If ESC is hit, the formatted original value should be restored to the widget, and I think edit mode of the property should be ended.
Fixing the other issue brings up a few more situations to worry about. For example, a backing value of 17.0026 could be displayed as 17.0. But it is possible that the user actually wants to edit the value and set it to exactly 17. So I think we do need to support that case also, but probably only via an explicit Enter key. Here is what I think the Booster team would like to see for behavior once in edit mode:
if (loseFocus) {
if (edit string != originalFormattedString)
tryCommit()
} else if (EnterKey)
tryCommit()
}
tryCommit() {
newValue = parse(editText)
if (isValid(newValue) && newValue != originalValue)
commitForReal()
}
Screenshots
No response
Desktop (please complete the applicable information)
iTwin.js 4.7.2
AppUI 4.12.0
Additional context
No response
The text was updated successfully, but these errors were encountered: