Skip to content

fix(ui5-input): update previousValue on programmatic value change while focused - #14040

Open
ivoplashkov wants to merge 2 commits into
UI5:mainfrom
ivoplashkov:fix/ui5-input-previousvalue-not-updated-on-programmatic-change
Open

fix(ui5-input): update previousValue on programmatic value change while focused#14040
ivoplashkov wants to merge 2 commits into
UI5:mainfrom
ivoplashkov:fix/ui5-input-previousvalue-not-updated-on-programmatic-change

Conversation

@ivoplashkov

Copy link
Copy Markdown
Contributor

Summary

  • When value is changed programmatically while the input is focused, previousValue was not updated
  • This caused the change event to be silently dropped when the user later typed the same value as the original previousValue
  • Fix: in onBeforeRendering, sync previousValue to this.value when focused and not typing — mirroring native <input> behavior where setting .value via script resets the change-detection baseline

Root cause

previousValue is set once in _onfocusin and never updated when this.value is mutated externally while focused. Native <input> updates its internal "last committed value" reference whenever value is 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 → change must fire.

Fixes #14034

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ui5-input]: this.previousValue is not updated when the 'value' is not updated by typing

1 participant