@@ -229,7 +229,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
229
229
private srgbOverlay : SrgbOverlay . SrgbOverlay . SrgbOverlay ;
230
230
private contrastOverlay : ContrastOverlay | undefined ;
231
231
private contrastDetails : ContrastDetails | undefined ;
232
- private readonly contrastDetailsBackgroundColorPickedToggledBound :
232
+ private readonly contrastDetailsBackgroundColorPickerToggledBound :
233
233
( ( event : Common . EventTarget . EventTargetEvent < boolean > ) => void ) | undefined ;
234
234
private readonly palettes : Map < string , Palette > ;
235
235
private readonly palettePanel : HTMLElement ;
@@ -399,8 +399,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
399
399
this . contrastInfo , this . contentElement , this . toggleColorPicker . bind ( this ) ,
400
400
this . contrastPanelExpandedChanged . bind ( this ) , this . colorSelected . bind ( this ) ) ;
401
401
402
- this . contrastDetailsBackgroundColorPickedToggledBound =
403
- this . contrastDetailsBackgroundColorPickedToggled . bind ( this ) ;
402
+ this . contrastDetailsBackgroundColorPickerToggledBound =
403
+ this . contrastDetailsBackgroundColorPickerToggled . bind ( this ) ;
404
404
}
405
405
406
406
this . element . classList . add ( 'flex-none' ) ;
@@ -572,7 +572,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
572
572
return true ;
573
573
}
574
574
575
- private contrastDetailsBackgroundColorPickedToggled ( event : {
575
+ private contrastDetailsBackgroundColorPickerToggled ( event : {
576
576
data : unknown ,
577
577
} ) : void {
578
578
if ( event . data ) {
@@ -1355,19 +1355,19 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
1355
1355
this . colorPickerButton . setToggled ( false ) ;
1356
1356
}
1357
1357
1358
- if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickedToggledBound ) {
1358
+ if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickerToggledBound ) {
1359
1359
this . contrastDetails . addEventListener (
1360
1360
ContrastDetailsEvents . BACKGROUND_COLOR_PICKER_WILL_BE_TOGGLED ,
1361
- this . contrastDetailsBackgroundColorPickedToggledBound ) ;
1361
+ this . contrastDetailsBackgroundColorPickerToggledBound ) ;
1362
1362
}
1363
1363
}
1364
1364
1365
1365
override willHide ( ) : void {
1366
1366
void this . toggleColorPicker ( false ) ;
1367
- if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickedToggledBound ) {
1367
+ if ( this . contrastDetails && this . contrastDetailsBackgroundColorPickerToggledBound ) {
1368
1368
this . contrastDetails . removeEventListener (
1369
1369
ContrastDetailsEvents . BACKGROUND_COLOR_PICKER_WILL_BE_TOGGLED ,
1370
- this . contrastDetailsBackgroundColorPickedToggledBound ) ;
1370
+ this . contrastDetailsBackgroundColorPickerToggledBound ) ;
1371
1371
}
1372
1372
}
1373
1373
@@ -1376,9 +1376,10 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
1376
1376
enabled = this . colorPickerButton . isToggled ( ) ;
1377
1377
}
1378
1378
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 ( ) ) {
1382
1383
this . contrastDetails . toggleBackgroundColorPicker ( false ) ;
1383
1384
}
1384
1385
0 commit comments