Skip to content

Commit

Permalink
Fixing collor pickers in the admin console (mattermost#4436)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino authored and Willyfrog committed Dec 5, 2019
1 parent 490795c commit 91447e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/admin_console/color_setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ export default class ColorSetting extends React.PureComponent<Props, State> {
}

private closePicker = (e: MouseEvent) => {
if (e.target && (e.target as HTMLElement).closest('.' + this.getPickerClass())) {
this.setState({showPicker: false});
if (e.target) {
const closest = (e.target as HTMLElement).closest('.' + this.getPickerClass());
if (!closest || !closest.contains(e.target as HTMLElement)) {
this.setState({showPicker: false});
}
}
}

Expand Down

0 comments on commit 91447e5

Please sign in to comment.