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

Remove extra inner padding on text blocks #992

Closed
iamthomasbishop opened this issue May 17, 2019 · 14 comments · Fixed by #1560
Closed

Remove extra inner padding on text blocks #992

iamthomasbishop opened this issue May 17, 2019 · 14 comments · Fixed by #1560

Comments

@iamthomasbishop
Copy link
Contributor

Since we last solved these issues looks like there might have been a regression in one of the last releases. There is some extra padding applied inside the body of text blocks (paragraph, heading, etc). It's slightly different between platforms:

iOS

There appears to be a slight bit of additional left/right padding. It's hard to tell if there's also extra padding on top/bottom edges of the blocks, so we should double check. Same thing applied to the title (only on iOS).

57C57374-7663-41BD-A8BE-C42B558C371A

Android

It looks like extra top/bottom padding, but left/right looks aligned properly.

(Note: title block looks to have proper padding.)

681D53FD-67D9-4486-AC30-6F1AD68F289F
060C26AF-EDB5-4240-80BF-26C73DBED080

Note

All blocks have inner padding of 12 top/bottom, 16 left/right, so the total vertical spacing between blocks is always 24.

@iamthomasbishop iamthomasbishop added this to the v1.5 milestone May 17, 2019
@koke koke removed this from the v1.5 milestone May 17, 2019
@koke
Copy link
Member

koke commented May 17, 2019

Removed the 1.5 milestone, let's only use milestones for PRs

@iamthomasbishop
Copy link
Contributor Author

Sounds good, apologies!

@maxme
Copy link
Contributor

maxme commented Nov 8, 2019

On Android, I did a quick sanity check - loaded the a test post with the block editor in the Layout inspector. Then I took a screenshot with Material Grid and added the layout inspector over it. Here is the result of this:

Screenshot 2019-11-08 at 13 48 50

From this screen shot:

  • It looks like we have a margin on each block.
  • And some padding on each text "area" (title / heading / paragraph).
  • The block toolbar (up / down - trash buttons) height looks good.

I think that removing the padding on text area would fix this problem on Android. I'll investigate more to check where this is coming from (RichText component? Aztec? glue code?).

@maxme maxme self-assigned this Nov 8, 2019
@koke
Copy link
Member

koke commented Nov 8, 2019

There might be some related changes in #1379, or at least I was discussing block margins there yesterday

@maxme
Copy link
Contributor

maxme commented Nov 8, 2019

Note: I found a source of extra padding in the example app, I was able to remove it, but apparently there is a different issue in the wpandroid integration.

out

@maxme
Copy link
Contributor

maxme commented Nov 8, 2019

By setting adding aztecText.setPadding(0, 0, 0, 0); in the ReactAztecManager.createViewInstance() call, I'm able to remove the padding on RichText in wpandroid integration:

Screenshot 2019-11-08 at 15 24 31

But for some reason when using bigger font in a RichText (see the heading block in this screen shot) there is some extra vertical white space which is not a padding. See here:

Screenshot 2019-11-08 at 15 25 10

Note: I also checked the ReactAztecText wasn't wrapped in another padded view.

@maxme
Copy link
Contributor

maxme commented Nov 8, 2019

This extra vertical white space is probably coming from heading rendering code in Aztec. For reference here is the screenshot of the Aztec version of this post.

Screenshot_1573223538

@maxme
Copy link
Contributor

maxme commented Nov 8, 2019

I confirm the heading issue must be fixed on the Aztec side. It's currently not parametrized, but it can be. I'll update Aztec, do a new release and then update the PR here.

out

(I removed the vertical space in the "after" screenshot)

@iamthomasbishop
Copy link
Contributor Author

Interesting notes above. @maxme. Do you know what the line-heights are set to for headings? I wonder if that has something to do with the additional optical spacing. For example, here's what the measurements of a Heading 2 block look like (22px font-size 28px line-height:

image

For reference, here is the type scale I'm following (font-size/line-height):

  • H1: 24/32 (~1.33)
  • H2: 22/28 (~1.27)
  • H3: 20/26 (1.3)
  • H4: 18/22 (~1.22)
  • H5: 16/20 (1.25)
  • H6: 14/18 (~1.29)
  • Paragraph: 16/24 (1.5)

If we need to, we can define a standard formula/ratio and stick to it. FWIW, I propsed a refinment to the base (paragraph) alignment, but the headings need to be a little bit tighter, so they could be set to something between to 1.2 or 1.4. IIRC, there is also a difference in how Android and iOS handle line-height equivalents, so I wonder if we might need to define this differently for each platform.

Inspecting core GB, it looks like some headings use a line-height of 1.8 and some use 1.4 – not sure if they're following a scale or not.

@maxme
Copy link
Contributor

maxme commented Nov 12, 2019

Do you know what the line-heights are set to for headings? I wonder if that has something to do with the additional optical spacing

The line-height implementation is defined in the Android TextView (we use it as the base class for Aztec). And we set these values here for all text in an Aztec instance.

We could change that for each block but I'm not sure that's what you want (line-height and block padding are different things. line-height is the parameter that drives the vertical space between 2 lines when a long heading line is wrapped).

I'll take screenshots with long lines after updating the headings padding in Aztec and check if that's what we want.

@hypest
Copy link
Contributor

hypest commented Mar 13, 2020

This ticket looks closed by @mchowning but I only see Android side work on it. Aren't there still some iOS side adjustments that are pending?

@iamthomasbishop
Copy link
Contributor Author

iamthomasbishop commented Mar 13, 2020

@hypest Looking at the latest internal beta, we seem mostly good on iOS, except the title seems to suffer the same issue that I mentioned above.

Also realized that the Separator block line also isn't quite wide enough (screenshot), so I'll report that separately.

@etoledom
Copy link
Contributor

etoledom commented Mar 16, 2020

I have created a ticket for the Post Title issue on iOS to keep this one closed.

@maxme
Copy link
Contributor

maxme commented Mar 16, 2020

Aren't there still some iOS side adjustments that are pending?

I'm pretty sure @SergioEstevao made some adjustments on the iOS side, I couldn't find the PR though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants