You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When the color picker's initial selectedColor value is the emptyColor then the first color selected is not set.
I believe the fix is quite easy but haven't been able to test it myself. Just a couple of changes in projects/material-community-components/color-picker/color-picker-selector.component.ts. When the user clicks on the color palette the changeColor is called and it emits a new value this._tmpSelectedColor.next(color);. That triggers the subscription in ngOnInit to be called where it does a check to see if there is a color if (this.noColor) {. The problem is that changeColor does not change this.noColor to be false until after it emits on this._tmpSelectedColor.
I think this.noColor needs to be set to false before emitting on this._tmpSelectedColor. I found two places that need to change:
To Reproduce
Steps to reproduce the behavior:
Go to a color picker with the selected color set equal to the empty color
Open the color picker
Click in the color palette
Notice that the color is not selected
Expected behavior
I expect the color to change on the first selection.
Screenshots
Desktop (please complete the following information):
OS: MacOS 11.0.1
Browser Chrome 86.0.4240.198
Additional context
I tried to make the fix myself in order to make a PR. But I've been having a lot of trouble getting the library to run in my own Angular app locally. I suspect this to be due to the new way libraries are built with Ivy. If you have any pointers on how to get this working I would love to be able to open new PRs in the future with any fixes I can make.
The text was updated successfully, but these errors were encountered:
Describe the bug
When the color picker's initial
selectedColor
value is theemptyColor
then the first color selected is not set.I believe the fix is quite easy but haven't been able to test it myself. Just a couple of changes in
projects/material-community-components/color-picker/color-picker-selector.component.ts
. When the user clicks on the color palette thechangeColor
is called and it emits a new valuethis._tmpSelectedColor.next(color);
. That triggers the subscription inngOnInit
to be called where it does a check to see if there is a colorif (this.noColor) {
. The problem is thatchangeColor
does not changethis.noColor
to befalse
until after it emits onthis._tmpSelectedColor
.I think
this.noColor
needs to be set tofalse
before emitting onthis._tmpSelectedColor
. I found two places that need to change:To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the color to change on the first selection.
Screenshots
Desktop (please complete the following information):
Additional context
I tried to make the fix myself in order to make a PR. But I've been having a lot of trouble getting the library to run in my own Angular app locally. I suspect this to be due to the new way libraries are built with Ivy. If you have any pointers on how to get this working I would love to be able to open new PRs in the future with any fixes I can make.
The text was updated successfully, but these errors were encountered: