tiaguinho / material-community-components

:panda_face: Angular Material Components created from the community

Home Page:https://tiaguinho.github.io/material-community-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validator checking "empty" value of hex color not working properly

striky1 opened this issue · comments

Describe the bug
When you using directives (MccColorPickerOrigin and MccConnectedColorPicker) on basic text input with RXJS forms and you want to check if is input empty (required) there is a problem when you have some value, e.g. #fff, and you selected whole value, then clicked delete/backspace and then in formControl you will have still same value #fff BUT if you will erase value with character by character (eg. #fff => #ff => #f => # => '') in form will be just value # what is ok because you can write custom Form Validator.

To Reproduce
Steps to reproduce the behavior:

  1. Make basic form with one input and custom validator which will check if value is # and if, input is invalid
  2. Select whole value in input and delete it with backspace or delete keyboard
  3. Form is valid!

When it works:

  1. Same as 1. point in previous steps
  2. Delete character by character
  3. Form is invalid

Expected behavior
Should works with whole value delete

Desktop (please complete the following information):

  • OS: macOS High Sierra 10.13.6
  • Browser: Chrome v68.0.3440.106
  • Material Community Components: v3.2.1

This is still happening in v6.0.0?

Hi 👋 @tiaguinho / @motabass ,

sorry for late response. I checked it on version 7.1.0 and it's worse than before.

Right now User is not able to reset value in Reactive Form Fields at all. If User will use backspace, Form Field will have value as shorthand of some color. If User will select whole value and then hit delete/backspace button, Form Field will have same value as before.

StackBlitz: https://stackblitz.com/edit/angular-ivy-zb3mau?file=src/app/app.component.html

Thank you for your reply.

striky..

@striky1 did you also try 9.0.0?

👋 @motabass,

yep, it's gone. I tested it in our App and newest version fix our issue.

Thank you.