Make WordPress Core

Opened 13 months ago

Last modified 13 months ago

#63673 accepted enhancement

Various inconsistencies in connection with the ‘Crop’ function

Reported by: Presskopp Owned by: joedolson
Priority: normal Milestone: Awaiting Review
Component: Media Version:
Severity: normal Keywords: has-patch
Cc: Focuses: ui, javascript, administration

Description

When Cropping an Image from the "Image Details Edit" screen there are some inconsistencies as follows:

the min values for imgedit-sel-width-[image-id] as well as imgedit-sel-height-[image-id] are set to 0, but you are unable to set any number lesser then 7. After you entered 7 or more, you will be able to enter a lesser number in the secons field.

When you empty the fields the cropped selection should be cleared as if the "Clear Crop" button was pushed.

When you enter selection values the cropped selection should appear as if the "Crop" button was pushed.

See attached video, which hopefully makes things more clear.

Attachments (1)

Crop.mp4 (6.3 MB ) - added by Presskopp 13 months ago.

Change History (5)

@Presskopp
13 months ago

#1 @joedolson
13 months ago

  • Owner set to joedolson
  • Status newaccepted

but you are unable to set any number lesser then 7. After you entered 7 or more, you will be able to enter a lesser number in the secons field.

Well, that's super weird...

Some of this is definitely historic issues with crop, rather than the changes I made for 6.3.

I'm taking ownership here, but some of this look a bit gnarly, so not going to milestone it just yet...

#2 @joedolson
13 months ago

  • Focuses javascript added

#3 @Presskopp
13 months ago

further findings:

1) The buttons "Apply Crop" and "Clear Crop" are not in line. This can be fixed by adding the class "button" to the "Apply Crop" button like in <button class="button button-primary" ...

2) The issue about not being able to enter any number less than 7 occurs not with every image, but still the issue will be there, only the numbers seem to change (weird).

3) In the help text it states "The minimum selection size is the thumbnail size as set in the Media settings." But that seems not to be the case.

3a) And while we're on it, "Media settings" could be a link to "/wp-admin/options-media.php".

Last edited 13 months ago by Presskopp (previous) (diff)

This ticket was mentioned in PR #9337 on WordPress/wordpress-develop by @devansh2002.


13 months ago
#4

  • Keywords has-patch added

Fixes #63673

Summary

  • Fix button styling by consolidating duplicate class attributes on Apply Crop button
  • Improve input field validation to handle empty values and auto-clear selection
  • Add logic to automatically clear crop selection when both width/height fields are empty
  • Enhance numeric validation to prevent weird input behavior with small numbers

Trac ticket: https://core.trac.wordpress.org/ticket/63673

Note: See TracTickets for help on using tickets.