microsoft / fast

The adaptive interface system for modern web experiences.
https://www.fast.design
Other
9.25k stars 590 forks source link

fix: Value of text-field is not updated when the text-field type changes #6827

Closed sonntag-philipp closed 3 months ago

sonntag-philipp commented 1 year ago

πŸ› Bug Report

When changing the type of a text-field which already contains content, the rules of the new type are automatically applied by the browser. This causes an automatic value change of the inner input element. This change is not reflected back to users of the web component. This makes the value that is display differ from the value that is accessible by the developer.

πŸ’» Repro or Code Sample

I think this StackBlitz repro is the best explaination.

Steps to reproduce:

  1. Paste the following text in the text-field: "Demo Text with leading spaces. ".
  2. Open the JS console
  3. Log the values using both buttons
  4. Change the type of the text-field
    • Notice the visible change of the value
  5. Log the values of the text-field again

πŸ€” Expected Behavior

The change of the inner input element should reflect back to the custom element and thus the user of the custom element.

😯 Current Behavior

The value of the inner input element is not reflected back to the custom element after an automatic value change due to the type change of the input.

πŸ’ Possible Solution

Two-Way Binding of the value property.

πŸ”¦ Context

It doesn't affect me currently, as the type of an input field should not change after the user has set any value in my opinion. Even though this is an edge case, I think it is necessary to fix this behaviour.
This behaviour could be really confusing, especially while developing automated UI tests.

🌍 Your Environment

janechu commented 3 months ago

Unfortunately @microsoft/fast-foundation is being deprecated, refer to #6955. I see this was mentioned in a PR, we will be addressing open PRs and merging what we can before we snap an archive branch to preserve the latest state of Foundation, however to bring us up to date I am closing out issues.