From e8fe783fb456aaf4cff2c3e6694765a2f3c8e507 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 26 Jan 2023 14:22:04 -0500 Subject: [PATCH] fixes #1157 --- docs/resources/changelog.md | 1 + src/components/color-picker/color-picker.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index 8fdfe439..af9d070b 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -10,6 +10,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` where the play and pause buttons were transposed [#1147](https://github.com/shoelace-style/shoelace/issues/1147) - Fixed a bug that prevented `web-types.json` from being generated [#1154](https://github.com/shoelace-style/shoelace/discussions/1154) +- Fixe a bug in `` that prevented `sl-change` and `sl-input` from emitting when using the eye dropper [#1157](https://github.com/shoelace-style/shoelace/issues/1157) ## 2.0.0 diff --git a/src/components/color-picker/color-picker.ts b/src/components/color-picker/color-picker.ts index 4bb47920..2df8028a 100644 --- a/src/components/color-picker/color-picker.ts +++ b/src/components/color-picker/color-picker.ts @@ -563,7 +563,16 @@ export default class SlColorPicker extends ShoelaceElement implements ShoelaceFo eyeDropper .open() - .then(colorSelectionResult => this.setColor(colorSelectionResult.sRGBHex)) + .then(colorSelectionResult => { + const oldValue = this.value; + + this.setColor(colorSelectionResult.sRGBHex); + + if (this.value !== oldValue) { + this.emit('sl-change'); + this.emit('sl-input'); + } + }) .catch(() => { // The user canceled, do nothing });