#81391Focus area improvement
Description
Focus area should be instead a focus point like this: http://jonom.github.io/jquery-focuspoint/demos/helper/index.html
A point is simpler to handle than an area for both editors and developers.
(but maybe I’m failing to imagine an use case where an area is useful)
Also, Fluid viewhelpers f:media and f:image return an attribute ‘data-focus-area’ that is not useful because the coordinates are based on the original image size and the resulting image has been, most of the time, resized.
It’s better to use coordinates of a singular focus point X/Y that represent a percentage of shift from the top/left corner or, in alternative, from the center o the image (or the crop area).
Reviews 1
History 6
-
Riccardo De Contardi changed category <span data-processor="relativetime" data-value="2017-09-22T22:23:30+00:00" > 09/22/17, 22:23 </span>
-
Martin Kutschker commented <span data-processor="relativetime" data-value="2018-12-10T12:12:22+00:00" > 12/10/18, 12:12 </span>
-
Susanne Moog changed tracker
TaskFeature <span data-processor="relativetime" data-value="2019-03-03T17:07:10+00:00" > 03/03/19, 17:07 </span> -
Anonymous commented <span data-processor="relativetime" data-value="2020-02-20T10:58:26+00:00" > 02/20/20, 10:58 </span>
I can see usages for both arguments. A single point is very easy to use. Having an area provides more control over what has to be visible at all times.
But I cannot find any single existing frontend library which would work “easily” with this approach. For every single one (which are not much tbh) out there you have to decode the json from data-focus-area and translate it to single data-attributes which in addition have to be calculated to provide the expected value for the library. Trying a CSS only approach with background-position is impossible due to the fact that the values of data-focus-area are not accessible in CSS.
I think it would be a good step forward to provide the values from data-focus-area as separate data-attributes. Then they are usable in CSS and if a JS library expects those kind of values there might be a config option to define to name of data-attribute for each value.
Or provide a Slot to hook into to manually change how the values are output. Then they also could be recalculated to fit the needs of the used JS lib.Focus Areas in TYPO3 are a great feature. But I guess nobody uses them. Even me until yesterday. I reported this bug https://forge.typo3.org/issues/90437 yesterday which already has a Patch (great work for that). But the mentioned related patch set which caused this bug https://review.typo3.org/c/Packages/TYPO3.CMS/+/52313 is from April 2017. So focus areas haven’t been usable for almost 3 years now.
So maybe this feature needs to be a bit more flexible to be used by people. Otherwise someone would have found that bug way before me.
-
Susanne Moog commented <span data-processor="relativetime" data-value="2020-03-24T08:20:01+00:00" > 03/24/20, 08:20 </span>
I guess the one most people actually use is https://extensions.typo3.org/extension/focuspoint
-
Georg Ringer commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-10-03T05:17:26+00:00" > 10/03/26, 05:17 </span>Thanks for the report and for all the input over the years. This issue mixes two topics, so here is the current state of both.
Wrong coordinates in data-focus-area
The coordinates in the
data-focus-areaattribute off:image,f:mediaand the backend thumbnail ViewHelper were calculated from the dimensions of the original file. As soon as the image was cropped or scaled down, they did not describe the rendered image anymore.This has been fixed with #97535 (“Base focus area on the processed image”, main and 14.3). The coordinates are now based on the processed image, so they always refer to the
imgtag they are rendered on.Focus point instead of focus area
A focus area covers everything a focus point does: the center of the area is the focus point. On top of that, an area allows defining a region that must stay visible, e.g. a whole face, as Martin already pointed out. Replacing the area with a single point would therefore remove functionality, so this won’t be changed in the core. Extensions like EXT:focuspoint are available if a point-based approach is preferred.
The idea of providing the values in a more consumable format (e.g. separate or relative data attributes, or an event to modify the output) is a different topic. If there is a concrete need, please open a new feature request for that.
As the bug part is solved by #97535 and the point vs. area part won’t be implemented in near future, I’m closing the issue. Feel free to comment if anything is missing.
Areas are useful if you make sure that the whole face of a person is visible, etc. So IMHO having only a singular point is not an enhancement.