Skip to content

Commit

Permalink
[Gradient Tool]: Fix closing of popover when the angle control is cli…
Browse files Browse the repository at this point in the history
…cked (#40735)
  • Loading branch information
ntsekouras committed May 3, 2022
1 parent 6d927e5 commit 739b871
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/angle-picker-control/angle-circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ function AngleCircle( { value, onChange, ...props } ) {

const changeAngleToPosition = ( event ) => {
const { x: centerX, y: centerY } = angleCircleCenter.current;
const { ownerDocument } = angleCircleRef.current;
// Prevent (drag) mouse events from selecting and accidentally
// triggering actions from other elements.
event.preventDefault();
// Ensure the input isn't focused as preventDefault would leave it.
ownerDocument.activeElement.blur();
// Input control needs to lose focus and by preventDefault above, it doesn't.
event.target.focus();
onChange( getAngle( centerX, centerY, event.clientX, event.clientY ) );
};

Expand Down Expand Up @@ -72,6 +71,7 @@ function AngleCircle( { value, onChange, ...props } ) {
value ? { transform: `rotate(${ value }deg)` } : undefined
}
className="components-angle-picker-control__angle-circle-indicator-wrapper"
tabIndex={ -1 }
>
<CircleIndicator className="components-angle-picker-control__angle-circle-indicator" />
</CircleIndicatorWrapper>
Expand Down

0 comments on commit 739b871

Please sign in to comment.