fix(ui5-input): update previousValue on programmatic value change while focused - #14040
Open
ivoplashkov wants to merge 2 commits into
Open
Conversation
…le focused When the input's value is changed programmatically while focused, previousValue was not updated, so a subsequent user-typed value equal to the original previousValue would not trigger a change event. This mirrors native <input> behavior: setting .value via script resets the browser's internal change-detection baseline to the new value. Fixes UI5#14034
…ions The external-change sync in onBeforeRendering must not run when the component itself changes the value (clear icon, Escape revert). A _preventPreviousValueUpdate flag is set before internal mutations and cleared at the start of the next onBeforeRendering pass to avoid interfering with clear-icon and suggestion-revert change detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
valueis changed programmatically while the input is focused,previousValuewas not updatedchangeevent to be silently dropped when the user later typed the same value as the originalpreviousValueonBeforeRendering, syncpreviousValuetothis.valuewhen focused and not typing — mirroring native<input>behavior where setting.valuevia script resets the change-detection baselineRoot cause
previousValueis set once in_onfocusinand never updated whenthis.valueis mutated externally while focused. Native<input>updates its internal "last committed value" reference whenevervalueis set via script (per the HTML spec), so programmatic resets are properly accounted for in change detection.Test
Added a Cypress regression test: focus input with value
"f"→ programmatically reset to""→ type"f"→ blur →changemust fire.Fixes #14034