Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input Field Number - placeholder is shown instead of value (0) when readonly is true #725

Open
Tracked by #452
thrbnhrtmnn opened this issue Jan 4, 2024 · 3 comments · May be fixed by #1173
Open
Tracked by #452

Input Field Number - placeholder is shown instead of value (0) when readonly is true #725

thrbnhrtmnn opened this issue Jan 4, 2024 · 3 comments · May be fixed by #1173
Assignees
Labels
💚 contributor issue Good for contributors ⌨️ dev issue Task is for developers 🚨 new::bug Something isn't working

Comments

@thrbnhrtmnn
Copy link
Contributor

thrbnhrtmnn commented Jan 4, 2024

Step-by-Step Guide to reproduce

  1. Open Input Field Number in Storybook
  2. Set a value = 0
  3. Set readonly to true
  4. See that value is not shown

If a different value is set than 0, the bug is not occuring.


Bug Description / False Behaviour

When the Input Field Number has a value and readonly=true, it does not display the value.


Correct Behaviour

When the Input Field Number has a value and readonly=true, it displays the value.


Testing

Check existing unit tests of the component(s) and adjust the tests to prevent this bug from occurring again in the future, if you see a way.


Background

  • When a placeholder is set, the placeholder is shown, even in readonly state.
@thrbnhrtmnn thrbnhrtmnn added 🚨 new::bug Something isn't working ⌨️ dev issue Task is for developers 💚 contributor issue Good for contributors labels Jan 4, 2024
@usmanreal1
Copy link
Contributor

Hi @thrbnhrtmnn ,

Since it's related to my last PR I had a look.

The reason that value is being reset here to placeholder or if we remove the condition I introduced in my last PR then to 0 is when readonly or disable or any other parms is set, it rerenders with a new instance with default params hence overwriting the existing set values.

For example if we set the value to 24 in defaultParams, then on readonly set to true, the value will be reset to 24 instead of the placeholder.

So, this is just not the case with readonly but with all the parameters even when you change the theme from light to dark.

Maybe I am missing something here but let me know what do you think.

@ChristianHoffmannS2
Copy link
Collaborator

@usmanreal1 i think this is how storybook does things. instead of changing one attribute on the web-component, it replaces the thing with an entirely new instance.

in order to determinate if that's the issue here, we could place the number input into the example app and see how it behaves over there. i would suggest to give this a shot. if you need any help with that, you can write here :)

@thrbnhrtmnn thrbnhrtmnn changed the title Number Input - placeholder is shown instead of value when readonly is true Number Input - placeholder is shown instead of value (0) when readonly is true Feb 27, 2024
@thrbnhrtmnn thrbnhrtmnn changed the title Number Input - placeholder is shown instead of value (0) when readonly is true Input Field Number - placeholder is shown instead of value (0) when readonly is true Mar 26, 2024
@bar-tay bar-tay self-assigned this Sep 6, 2024
@bar-tay
Copy link
Contributor

bar-tay commented Sep 16, 2024

in order to determinate if that's the issue here, we could place the number input into the example app and see how it behaves over there. i would suggest to give this a shot. if you need any help with that, you can write here :)

@ChristianHoffmannS2 could you maybe explain to me what we expect from that approach of putting the input into the example app.
Should I just put the current input into the example app with the readonly state and see if it behaves accordingly?

@ashk1996 ashk1996 assigned ashk1996 and unassigned bar-tay Nov 4, 2024
@ashk1996 ashk1996 linked a pull request Nov 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💚 contributor issue Good for contributors ⌨️ dev issue Task is for developers 🚨 new::bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants