Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/scratch-gui/src/components/green-flag/green-flag.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import React, {useCallback} from 'react';

import greenFlagIcon from './icon--green-flag.svg';
import styles from './green-flag.css';
Expand All @@ -13,10 +13,20 @@ const GreenFlagComponent = function (props) {
title,
...componentProps
} = props;

// Unfocus so project stage can capture keyboard events for
// blocks that react to arrow movement for example
const handleOnClick = useCallback(e => {
onClick(e);

const target = e.currentTarget;
if (target) target.blur();
}, [onClick]);

return (
<button
className={styles.greenFlagButton}
onClick={onClick}
onClick={handleOnClick}
{...componentProps}
>
<img
Expand Down
Loading