From 74f990a208f6d48743d3a67bffdbd12e39d9a031 Mon Sep 17 00:00:00 2001 From: Andrea Roenning Date: Mon, 27 Apr 2026 15:00:13 -0500 Subject: [PATCH 1/4] Revise README for FocalPointPicker component to use object-position Updated the focal point picker's README to clarify the component's purpose both for background images and aspect ratio cropped images. Update example code to use `object-position` --- packages/components/src/focal-point-picker/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/components/src/focal-point-picker/README.md b/packages/components/src/focal-point-picker/README.md index 9abb147831409a..588a03f6b064ae 100644 --- a/packages/components/src/focal-point-picker/README.md +++ b/packages/components/src/focal-point-picker/README.md @@ -1,9 +1,9 @@ # FocalPointPicker -Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image. This component addresses a specific problem: with large background images it is common to see undesirable crops, especially when viewing on smaller viewports such as mobile phones. This component allows the selection of the point with the most important visual information and returns it as a pair of numbers between 0 and 1. This value can be easily converted into the CSS `background-position` attribute, and will ensure that the focal point is never cropped out, regardless of viewport. +Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image. It addresses two common issues in responsive image rendering. First, large background images are often cropped in undesirable ways, especially on smaller viewports such as mobile devices. Second, the CSS aspect-ratio property can inadvertently crop out the area of highest visual interest. This component allows the selection of the point with the most important visual information and returns it as a pair of numbers between 0 and 1. This value can be easily converted into the CSS `object-position` attribute, and will ensure that the focal point is never cropped out, regardless of viewport. - Example focal point picker value: `{ x: 0.5, y: 0.1 }` -- Corresponding CSS: `background-position: 50% 10%;` +- Corresponding CSS: `object-position: 50% 10%` ## Usage @@ -14,15 +14,14 @@ import { FocalPointPicker } from '@wordpress/components'; const Example = () => { const [ focalPoint, setFocalPoint ] = useState( { x: 0.5, - y: 0.5, + y: 0.1, } ); const url = '/path/to/image'; /* Example function to render the CSS styles based on Focal Point Picker value */ const style = { - backgroundImage: `url(${ url })`, - backgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`, + objectPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`, }; return ( @@ -34,7 +33,7 @@ const Example = () => { onDrag={ setFocalPoint } onChange={ setFocalPoint } /> -
+ ); }; From da62334d9086213bf0846631ea2e8e91401c7376 Mon Sep 17 00:00:00 2001 From: Andrea Roenning Date: Tue, 28 Apr 2026 10:59:54 -0500 Subject: [PATCH 2/4] Add background-image and update jsDoc --- .../src/focal-point-picker/README.md | 14 ++--- .../src/focal-point-picker/index.tsx | 52 ++++++++++--------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/packages/components/src/focal-point-picker/README.md b/packages/components/src/focal-point-picker/README.md index 588a03f6b064ae..4eaed176c36d91 100644 --- a/packages/components/src/focal-point-picker/README.md +++ b/packages/components/src/focal-point-picker/README.md @@ -1,15 +1,15 @@ # FocalPointPicker -Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image. It addresses two common issues in responsive image rendering. First, large background images are often cropped in undesirable ways, especially on smaller viewports such as mobile devices. Second, the CSS aspect-ratio property can inadvertently crop out the area of highest visual interest. This component allows the selection of the point with the most important visual information and returns it as a pair of numbers between 0 and 1. This value can be easily converted into the CSS `object-position` attribute, and will ensure that the focal point is never cropped out, regardless of viewport. +Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image. It addresses two common issues in responsive image rendering. First, large background images are often cropped in undesirable ways, especially on smaller viewports such as mobile devices. Second, the CSS aspect-ratio property can inadvertently crop out the area of highest visual interest. This component allows the selection of the point with the most important visual information and returns it as a pair of numbers between 0 and 1. The output value can be applied to either CSS `background-position` (for elements with `background-image`) or `object-position` (for `` / `