Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Focal points are not rounded #18765

merged 1 commit into from Nov 27, 2019


Copy link

jorgefilipecosta commented Nov 26, 2019


Fixes: #18665

Currently, the focal point is not rounded. That makes the cover block markup contain attributes and styles with many decimal places.
That precision is not required and rounding to two decimal places makes the markup cleaner and reduces some bytes on each cover block created.

How has this been tested?

I added a cover block with an image background.
I used the focal point picker and changed it using the mouse.
I switched to code editor mode, and verified the attributes and markup contained only two decimal places.

Copy link

youknowriad left a comment

I do wonder if it's too rounded now, maybe allow 2 more digits but LGTM anyway.


This comment has been minimized.

Copy link
Member Author

jorgefilipecosta commented Nov 27, 2019

I do wonder if it's too rounded now, maybe allow 2 more digits but LGTM anyway.

We set a relative position in percentage rounding to two digits makes the percentages integer. The way we set the focus point in a small area probably does not provide a higher precision anyway. I think this precision should be enough, but let us keep an eye if people notice a difference.

@jorgefilipecosta jorgefilipecosta merged commit a29186a into master Nov 27, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
@jorgefilipecosta jorgefilipecosta deleted the fix/focal-points-are-not-rounded branch Nov 27, 2019
@geriux geriux mentioned this pull request Dec 4, 2019
1 of 1 task complete
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.