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

Media & Text - Alignment #1312

Closed
pinarol opened this issue Aug 22, 2019 · 2 comments · Fixed by #1546 or WordPress/gutenberg#18300
Closed

Media & Text - Alignment #1312

pinarol opened this issue Aug 22, 2019 · 2 comments · Fixed by #1546 or WordPress/gutenberg#18300
Assignees
Labels
Beta Request [Type] Bug Something isn't working

Comments

@pinarol
Copy link
Contributor

pinarol commented Aug 22, 2019

Media & Text block text part is not aligning due to alignment options.

mediaText-alignment

Since text is shorter than media in this case it is expected that it moves:

Screen Shot 2019-08-22 at 19 28 36

Expected behaviour:

Text part is aligned similar to web:

mediaText-alignment2

@pinarol pinarol added the [Type] Enhancement Improves a current area of the editor label Aug 22, 2019
@designsimply designsimply added Beta Request [Type] Bug Something isn't working and removed [Type] Enhancement Improves a current area of the editor labels Oct 24, 2019
@designsimply
Copy link
Contributor

This came up in 13.5 beta testing. Steps to reproduce:

  1. Start a new post.
  2. Add a Media & Text block with an image and some text.
  3. Rotate the device to landscape to see the media and text side-by-side.
  4. Try to use the different alignment options showing for the block.

Result: horizontal alignment options don't work in the Media & Text block. It's quite easy to spot on iPad. (26s)
Tested with WPiOS 13.5.0.0 beta (TestFlight) on iPad Mini 4 (WiFi) (iPad5,1) iPadOS 13.1.2.

img_f4f26b8d60e1-1

/hat tip @rachelmcr for the report (internal reference: p5T066-136-p2#comment-3658)

@koke
Copy link
Member

koke commented Oct 28, 2019

I was investigating this on Friday, and what I know so far is that we have code in place to make this work, and that in a way it's doing what's expected. When you align some items vertically you'd expect to see something like this:

Align_Items

However, there is something making the media container and the inner blocks 100% tall, so even if they're actually aligned, there's no visual difference:

Align_Items_Tall

I started investigating the nested BlockList because I thought maybe that was problematic. Normally you want to specify a fixed height for a scroll view so its container view is bounded, and it can scroll when the content size is larger than the container:

InnerBlocks

However, I started a sample project with nested FlatList and it was working fine: https://snack.expo.io/@kokejb/scrollview-flexbox (I'd recommend testing on an iPad)

IMG_DD591C3B3EE6-1
IMG_D54E65CB7397-1

I noticed that FlatList is smart enough to detect when it's nested, and instead of adding a second ScrollView, it will use the context of the parent one. Our KeyboardAwareFlatList is not that smart and it adds another ScrollView to the hierarchy. I tried replacing it with a FlatList and it was still failing in a slightly different way.

Also, our media container is using ImageBackground and loading images from the network, which might be interfering with the flexbox calculations, as they re-render once they get the image sizes.

I started #1502, which doesn't have much yet, but the sample content is useful for testing all the cases.

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