angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.22k stars 6.69k forks source link

Long decimals from slider value when steps are .1 #10951

Closed nateclicks closed 6 years ago

nateclicks commented 6 years ago

Bug, feature request, or proposal:

Bug

What is the expected behavior?

The value displayed in the from to be only 1 decimal when using 1 decimal steps

What is the current behavior?

Sometimes it is one decimal, sometimes it is many more. image

image

This can also be observed in the Material Angular documentation image

What are the steps to reproduce?

  1. Create a slider
  2. Create a text box
  3. Set the slider steps to .1
  4. Bind the value of the slider to the textbox
  5. Slide the slider around
  6. Observe intermittent issues with long decimals

Editor URL: https://stackblitz.com/edit/angular-material2-example App URL: https://angular-material2-example.stackblitz.io

What is the use-case or motivation for changing an existing behavior?

The existing behavior seems incorrect.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.2.8 Material 5.2.5

Is there anything else we should know?

It looks there have been attempts to address this in other areas like the thumb label. Not sure if it has come back or just never got fully addressed or if there is just something I am doing wrong. Previous issue: https://github.com/angular/material2/issues/2511 , https://github.com/angular/material2/pull/2527

H3llK33p3r commented 6 years ago

Hi with the new angular/material stack the issue is fixed for mouse event but not keybord. Try with the previous example with new angular stack : https://stackblitz.com/edit/angular-material6-example?file=app/app.component.html

Use keyboard arrow you will see the same kind of problem.

crisbeto commented 6 years ago

Thanks for the heads-up @H3llK33p3r, I've submitted #11574 to sort it out.

alexciurea commented 6 years ago

hassio 0.73.0 - this is still a problem, even using the mouse.

my 2 input_numbers are defined in input_number.yaml

the High slider has this bug - the values ending with .2 .4 and .7 .8 get values like 1.2000000000000002, etc...

high comfort for climate control

comfortctrl_high:
  name: Comfort High
  initial: 1.5
  min: 1.1
  max: 1.8
  step: 0.1

the Low slider behaves correctly.

#Low comfort for climate control
comfortctrl_low:
  name: Comfort Low
  initial: 0.9
  min: 0
  max: 1
  step: 0.1
alexciurea commented 6 years ago

sorry - by mistake i missed to see this is angular and not [directly] relevant to home assistant/hassio issue tracker.

for now, please ignore my reporting that this is still an issue. I'm not even sure what angular version used by home assistant (and in fact, not even certain the 2 issues / projects are related - although the behavior is clearly similar). thanks -a

angular-automatic-lock-bot[bot] commented 4 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.