@@ -229,7 +229,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
229229 private srgbOverlay : SrgbOverlay . SrgbOverlay . SrgbOverlay ;
230230 private contrastOverlay : ContrastOverlay | undefined ;
231231 private contrastDetails : ContrastDetails | undefined ;
232- private readonly contrastDetailsBackgroundColorPickedToggledBound :
232+ private readonly contrastDetailsBackgroundColorPickerToggledBound :
233233 ( ( event : Common . EventTarget . EventTargetEvent < boolean > ) => void ) | undefined ;
234234 private readonly palettes : Map < string , Palette > ;
235235 private readonly palettePanel : HTMLElement ;
@@ -399,8 +399,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
399399 this . contrastInfo , this . contentElement , this . toggleColorPicker . bind ( this ) ,
400400 this . contrastPanelExpandedChanged . bind ( this ) , this . colorSelected . bind ( this ) ) ;
401401
402- this . contrastDetailsBackgroundColorPickedToggledBound =
403- this . contrastDetailsBackgroundColorPickedToggled . bind ( this ) ;
402+ this . contrastDetailsBackgroundColorPickerToggledBound =
403+ this . contrastDetailsBackgroundColorPickerToggled . bind ( this ) ;
404404 }
405405
406406 this . element . classList . add ( 'flex-none' ) ;
@@ -572,7 +572,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
572572 return true ;
573573 }
574574
575- private contrastDetailsBackgroundColorPickedToggled ( event : {
575+ private contrastDetailsBackgroundColorPickerToggled ( event : {
576576 data : unknown ,
577577 } ) : void {
578578 if ( event . data ) {
@@ -1355,19 +1355,19 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
13551355 this . colorPickerButton . setToggled ( false ) ;
13561356 }
13571357
1358- if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickedToggledBound ) {
1358+ if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickerToggledBound ) {
13591359 this . contrastDetails . addEventListener (
13601360 ContrastDetailsEvents . BACKGROUND_COLOR_PICKER_WILL_BE_TOGGLED ,
1361- this . contrastDetailsBackgroundColorPickedToggledBound ) ;
1361+ this . contrastDetailsBackgroundColorPickerToggledBound ) ;
13621362 }
13631363 }
13641364
13651365 override willHide ( ) : void {
13661366 void this . toggleColorPicker ( false ) ;
1367- if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickedToggledBound ) {
1367+ if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickerToggledBound ) {
13681368 this . contrastDetails . removeEventListener (
13691369 ContrastDetailsEvents . BACKGROUND_COLOR_PICKER_WILL_BE_TOGGLED ,
1370- this . contrastDetailsBackgroundColorPickedToggledBound ) ;
1370+ this . contrastDetailsBackgroundColorPickerToggledBound ) ;
13711371 }
13721372 }
13731373
@@ -1376,9 +1376,10 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
13761376 enabled = this . colorPickerButton . isToggled ( ) ;
13771377 }
13781378
1379- // This is to make sure that only one picker is open at a time
1380- // Also have a look at this.contrastDetailsBackgroundColorPickedToggled
1381- if ( this . contrastDetails && enabled && this . contrastDetails . backgroundColorPickerEnabled ( ) ) {
1379+ // This is to make sure that only one picker is open at a time (enabled is true) and
1380+ // the background color picker gets dismissed whenever the popup is closed by an Esc (enabled is false).
1381+ // Also have a look at this.contrastDetailsBackgroundColorPickedToggled.
1382+ if ( this . contrastDetails ?. backgroundColorPickerEnabled ( ) ) {
13821383 this . contrastDetails . toggleBackgroundColorPicker ( false ) ;
13831384 }
13841385
0 commit comments