Skip to content

chore: improve input value handling#10935

Merged
pskelin merged 21 commits intomainfrom
input-value-old
Jan 21, 2026
Merged

chore: improve input value handling#10935
pskelin merged 21 commits intomainfrom
input-value-old

Conversation

@pskelin
Copy link
Copy Markdown
Contributor

@pskelin pskelin commented Feb 24, 2025

<ui5-input> has a very complex logic for handling type=numeric, implemented by keeping _innerValue.

This has two issues:

  1. a patch is necessary in preact to render a value in the DOM only when it is different from the old value.
  2. this prevents forcing an old value on the input in case an event handler decides not to accept new state

This fix remove the preact patch returning it to default - if a value is set in the tempate, it will be set in the DOM (for native inputs this will always assign a value from the state, even if it is the same)

By removing the _innverValue, apps can automatically set an old value and it will propagate in the DOM.

Example before - an input that accepts only three numbers by setting the old value if more than three numbers arrive

type `123` -> input value is `123`
type `1234` -> input value prop is `123` but input value in dom is `1234`

Example after - when setting an old value, it will be updated in the inner input, so typing 1234 will correctly result in 123 both in .value property and in DOM.

see Input_old_value.html for example code

@github-actions github-actions Bot added the Stale label Mar 26, 2025
@github-actions github-actions Bot removed the Stale label Mar 27, 2025
@github-actions github-actions Bot added the Stale label May 20, 2025
@github-actions github-actions Bot closed this May 28, 2025
@pskelin pskelin reopened this Oct 27, 2025
@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

ui5-webcomponents-bot commented Oct 27, 2025

🧹 Preview deployment cleaned up: https://pr-10935--ui5-webcomponents.netlify.app

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 27, 2025 08:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 27, 2025 08:56 Inactive
@pskelin pskelin reopened this Jan 5, 2026
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 5, 2026 07:19 Inactive
@github-actions github-actions Bot removed the Stale label Jan 6, 2026
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 6, 2026 08:16 Inactive
@github-actions github-actions Bot added the Stale label Jan 21, 2026
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 21, 2026 06:00 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 21, 2026 08:17 Inactive
Copy link
Copy Markdown
Contributor

@MapTo0 MapTo0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for inputs

Copy link
Copy Markdown
Contributor

@ilhan007 ilhan007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 1 (the test are green)

@pskelin pskelin merged commit 077efaf into main Jan 21, 2026
21 of 22 checks passed
@pskelin pskelin deleted the input-value-old branch January 21, 2026 18:07
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 21, 2026 18:07 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants