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

[RNMobile] Styling fixes after navigation merge #19164

Merged
merged 9 commits into from
Jan 7, 2020

Conversation

lukewalczak
Copy link
Member

@lukewalczak lukewalczak commented Dec 16, 2019

Description

That PR is fixing the issues mentioned in testing release after navigation feature merge

Ref to gb-mobile: wordpress-mobile/gutenberg-mobile#1682

How has this been tested?

  • As discussed earlier, there is an issue w/ the spacing of the Inline Toolbar.

I fixed vertical and horizontal padding in BlockMobileToolbar

not nested nested unsupported
Screenshot 2019-12-16 at 12 46 24 Screenshot 2019-12-16 at 12 46 09 Screenshot 2019-12-16 at 12 00 41
  • The margins/padding on the Columns block look a bit broken (screenshot). Unsupported, I know, but I tried adding one on web

  • Can we hide the Floating Toolbar on unsupported blocks like the Columns block, so that they don't say "unrecognized"?

Fixed both of them!

Screenshot 2019-12-16 at 12 50 07

  • It looks like there is extra padding applied on the Media & Text block now?

I was not able to reproduce it and it looks properly in my opinion

nested not nested
Screenshot 2019-12-16 at 12 52 23 Screenshot 2019-12-16 at 12 51 40
  • I know we had discussed the Appender spacing, but I think we might want to align to the same visual keyline as the child block borders

Fixed!

group with children empty group
Screenshot 2019-12-16 at 12 53 54 Screenshot 2019-12-16 at 12 54 24
  • Is it possible to remove the opacity-change effect when the breadcrumbs are tapped? Because nothing happens when I tap it (which is fine until we have the doc navigator), it might feel like a bug to users.

I disabled that touchable since there is an empty onPress function

  • When I add any type of RichText block within an empty Group, the input isn't focused right away – this felt odd, and it doesn't happen on a non-empty Group block.

Honestly, I would like to leave it for now, since I don't remember what was the cause of jumpiness in RichTexts and back to that once Jakub will be available.

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

@lukewalczak lukewalczak added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Dec 16, 2019
@lukewalczak
Copy link
Member Author

Can we hide the Floating Toolbar on unsupported blocks like the Columns block, so that they don't say "unrecognized"?

I've realized right now, that your suggestion is partly incorrect. What I mean is I agree that we can hide a toolbar when an unsupported block isn't nested, but in nested case, we should find other solution such as:

  • hide only breadcrumbs, but keep an arrow to move to the parent
  • Unrecognized block change for Unsupported block

@iamthomasbishop Please let me know what do you think about it

@iamthomasbishop
Copy link

Thanks for the quick fixes, everything is looking great here! Glad to see the Media & Text block is displaying properly here, I'm not sure why but when I tested, I was seeing the Media & Text block still side-by-side (not stacked as I'm seeing in your screenshots above, which is perfect).

I have 1 question, which is not an issue we need to solve here: in the screenshot above where you have the Media & Text block (parent) selected, is the media part of that not shown as a child because of the default selection logic – meaning it's "auto" selected by default?

@iamthomasbishop
Copy link

I've realized right now, that your suggestion is partly incorrect. What I mean is I agree that we can hide a toolbar when an unsupported block isn't nested, but in nested case, we should find other solution such as:

Now that I look at it again, I wonder if it'd be possible to just make sure the Unrecognized label says the name of the selected block (in my example, Columns). Is there a challenge in getting that label to match the selected block?

@lukewalczak
Copy link
Member Author

lukewalczak commented Dec 16, 2019

I have 1 question, which is not an issue we need to solve here: in the screenshot above where you have the Media & Text block (parent) selected, is the media part of that not shown as a child because of the default selection logic – meaning it's "auto" selected by default?

Sorry, but I don't understand what you meant 😢

Now that I look at it again, I wonder if it'd be possible to just make sure the Unrecognized label says the name of the selected block (in my example, Columns). Is there a challenge in getting that label to match the selected block?

I'll see what I can do! If I succeed then should I change the label in both cases or only in one (nested)? Also, what should I do in the scenario where getting the name will be too complicated?

@iamthomasbishop
Copy link

iamthomasbishop commented Dec 16, 2019

Sorry, but I don't understand what you meant

Apologies, my comment wasn't super clear. I meant there is no "child" outline style on media part of the Media & Text block. I was assuming this was related to our current selection logic, where the media part is auto-selected initially.

I'll see what I can do! If I succeed then should I change the label in both cases or only in one (nested)?

My thought is any time the floating toolbar is shown, the breadcrumb should say the name of the block that is selected. "Unrecognized" seems a bit weird to me.

Also, what should I do in the scenario where getting the name will be too complicated?

If impossible, I would make the label Unsupported.

@lukewalczak
Copy link
Member Author

@iamthomasbishop I've checked the possibilities to provide the original block name along with an icon will be complex in relation to benefit, that's why I've prepared a solution with Unsupported label, which is better than Unrecognized Block

nested not nested
Screenshot 2019-12-17 at 12 14 43 Screenshot 2019-12-17 at 12 14 46

Also, after pulling fresh changes I've noticed that items within Media&Text block are aligned one above the other on horizontal mode. You can check it here

@iamthomasbishop
Copy link

I've checked the possibilities to provide the original block name along with an icon will be complex in relation to benefit, that's why I've prepared a solution with Unsupported label, which is better than Unrecognized Block

This is definitely better. Is it also a similar difficulty to display the selected block icon (Columns icon in your example above) in the breadcrumbs instead of the generic block icon? Not the end of the world but it would be even nicer 😄

Also, after pulling fresh changes I've noticed that items within Media&Text block are aligned one above the other on horizontal mode. You can check it here

👍

@pinarol pinarol requested a review from koke December 18, 2019 12:39
Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me overall, let's wait for ✅ from @koke as well.

I spotted a weird anomaly during testing this but it turns out it has nothing to do with this PR.

@@ -228,7 +245,7 @@ class BlockListBlock extends Component {
style={ this.applyBlockStyle() }
>
{ isValid ? this.getBlockForType() : <BlockInvalidWarning blockTitle={ title } icon={ icon } /> }
{ isSelected && <BlockMobileToolbar clientId={ clientId } /> }
<View style={ this.applyToolbarStyle() } >{ isSelected && <BlockMobileToolbar clientId={ clientId } /> }</View>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather avoid using negative margins here. It seems that we should instead wrap the block content in another view and add the padding to that instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was afraid of negative margins as well, but decided to go with them because touching other styles were more dangerous for me.

@koke
Copy link
Contributor

koke commented Dec 20, 2019

I'm afraid unregistered/unsupported blocks might be a bigger deal than it seems and that we didn't anticipate in the previous PR. The problem is that they are rendering as a simple core/missing, but all the inner blocks navigation and styling logic is actually looking at the real block data that's unsupported. So even with this PR, if you nest a columns block inside a group, you get the wrong margins:

Simulator Screen Shot - iPhone 11 - 2019-12-20 at 10 12 26

One approach that initially seems to be working is to change the hasChildren check instead:

const hasChildren = ! isUnregisteredBlock && !! getBlockCount( clientId );

@koke
Copy link
Contributor

koke commented Dec 20, 2019

Unrelated to this I think, but the appender on an empty group isn't working. I thought I saw a PR fixing that a while back.

I know we had discussed the Appender spacing, but I think we might want to align to the same visual keyline as the child block borders

Shouldn't the empty group also get the same spacing?

@lukewalczak
Copy link
Member Author

Unrelated to this I think, but the appender on an empty group isn't working. I thought I saw a PR fixing that a while back.

I know we had discussed the Appender spacing, but I think we might want to align to the same visual keyline as the child block borders

Shouldn't the empty group also get the same spacing?

I think that empty group appender has a proper spacing, but please @iamthomasbishop let us know if this is correct.

empty group appender filled group appender
Screenshot 2019-12-20 at 11 27 36 Screenshot 2019-12-20 at 11 27 46

@lukewalczak lukewalczak force-pushed the rnmobile/fixes-after-navigation branch from c869968 to b5a801d Compare December 20, 2019 10:45
@lukewalczak
Copy link
Member Author

lukewalczak commented Dec 20, 2019

@koke Thanks for feedback and suggestions.
I've refactored:

  • Change Unrecognized Block in favour of Unsupported in missing block
  • Fix padding for nested Unsupported block, this is how it looks right now:
Testing HTML
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:image -->
<figure class="wp-block-image"><img alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Hello</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:group -->

<!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container"></div></div>
<!-- /wp:group -->

<!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:columns {"className":"gutenberg-landing\u002d\u002ddevelopers-columns"} -->
<div class="wp-block-columns has-2-columns gutenberg-landing--developers-columns">
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left"><strong>Built with modern technology.</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left">Gutenberg was developed on GitHub using the WordPress REST API, JavaScript, and React.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left","fontSize":"small"} -->
<p class="has-text-align-left has-small-font-size"><a href="https://wordpress.org/gutenberg/handbook/language/">Learn more</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left"><strong>Designed for compatibility.</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left">We recommend migrating features to blocks, but support for existing WordPress functionality remains. There will be transition paths for shortcodes, meta-boxes, and Custom Post Types.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left","fontSize":"small"} -->
<p class="has-text-align-left has-small-font-size"><a href="https://wordpress.org/gutenberg/handbook/reference/faq/">Learn more</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->

<!-- wp:paragraph -->
<p>Hello</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:group -->

<!-- wp:columns {"className":"gutenberg-landing\u002d\u002ddevelopers-columns"} -->
<div class="wp-block-columns has-2-columns gutenberg-landing--developers-columns">
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left"><strong>Built with modern technology.</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left">Gutenberg was developed on GitHub using the WordPress REST API, JavaScript, and React.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left","fontSize":"small"} -->
<p class="has-text-align-left has-small-font-size"><a href="https://wordpress.org/gutenberg/handbook/language/">Learn more</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left"><strong>Designed for compatibility.</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left"} -->
<p class="has-text-align-left">We recommend migrating features to blocks, but support for existing WordPress functionality remains. There will be transition paths for shortcodes, meta-boxes, and Custom Post Types.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"left","fontSize":"small"} -->
<p class="has-text-align-left has-small-font-size"><a href="https://wordpress.org/gutenberg/handbook/reference/faq/">Learn more</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
selected & nested selected & not nested unselected
Screenshot 2019-12-20 at 11 35 28 Screenshot 2019-12-20 at 11 35 32 Screenshot 2019-12-20 at 11 47 50

@lukewalczak lukewalczak force-pushed the rnmobile/fixes-after-navigation branch from 017f79a to ade20e1 Compare December 20, 2019 11:23
@iamthomasbishop
Copy link

@lukewalczak I think it’d probably make sense for the empty group appended to align to the same key lines as the filled one, but it’s not a blocker esp because it doesn’t conflict with a child outline (considering it doesn’t have siblings alongside it). So we can attack that in a separate issue if need be.

The last screenshots also look solid 👍 I can’t recall if there was an explicit decision on changing the selected/not-nested border, but I think we should eventually apply the same slight margin/inset that we use on the selected/nested one. Again this can be done separately, should not be considered a blocker on this.

@lukewalczak lukewalczak merged commit e864bbf into master Jan 7, 2020
@lukewalczak lukewalczak deleted the rnmobile/fixes-after-navigation branch January 7, 2020 08:33
@lukewalczak lukewalczak restored the rnmobile/fixes-after-navigation branch January 7, 2020 09:36
@lukewalczak lukewalczak deleted the rnmobile/fixes-after-navigation branch January 7, 2020 09:36
@lukewalczak lukewalczak restored the rnmobile/fixes-after-navigation branch January 7, 2020 09:39
@lukewalczak lukewalczak deleted the rnmobile/fixes-after-navigation branch January 7, 2020 09:51
@ellatrix ellatrix added this to the Gutenberg 7.3 milestone Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants