Skip to content

Conversation

solonaarmstrong-zz
Copy link

@solonaarmstrong-zz solonaarmstrong-zz commented Feb 12, 2019

WHY are these changes introduced?

Resolves #947

When using a vertical Stack the contents appear to break out of the container and "bleed" into surrounding padding when one of the children starts to wrap.

WHAT is this pull request doing?

Removes negative left margin from stack and left margin from item when vertical.

🤓 1024 - the gigabyte PR

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {Page, Card, Stack, Badge} from '../src';

interface State {}

export default class Playground extends React.Component<{}, State> {
  render() {
    return (
      <Page title="Playground">
        <Card sectioned>
          <Stack vertical>
            <div style={{backgroundColor: 'red'}}>Testing</div>
            <div>
              Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus
              sit amet rutrum tortor, quis condimentum lectus. Duis dui ligula,
              bibendum vel pharetra non, vulputate ut risus. Nam semper
              consequat nisl, sit amet consectetur purus vestibulum non. Duis
              molestie facilisis diam sit amet imperdiet. Praesent malesuada et
              nulla in mattis. Nullam aliquam luctus dui, id fermentum magna
              faucibus vitae. Ut ultrices dui vel lacus sodales, vel imperdiet
              quam facilisis. Curabitur dictum odio sit amet enim pretium
              consequat. Duis luctus sapien mattis sapien luctus tempor. Quisque
              vel purus quis orci dignissim pharetra sed sit amet turpis. Nam
              porttitor libero risus, ut facilisis lorem lobortis nec. Sed nec
              placerat sapien, eu auctor ex. Aliquam vel mattis neque. Integer
              pellentesque viverra fermentum.
            </div>
          </Stack>
        </Card>
        <br />
        <div style={{width: '200px'}}>
          <Card>
            <Stack vertical>
              <Badge>Badge with many words that wrap</Badge>
              <Badge>Badge with many words that wrap</Badge>
              <Badge>Badge with many words that wrap</Badge>
              <Badge>Badge with many words that wrap</Badge>
            </Stack>
          </Card>
        </div>
        <br />
        <div style={{width: '200px'}}>
          <Card>
            <Stack>
              <Badge>Badge</Badge>
              <Badge>Badge</Badge>
              <Badge>Badge</Badge>
              <Badge>Badge</Badge>
            </Stack>
          </Card>
        </div>
      </Page>
    );
  }
}

🎩 checklist

@BPScott BPScott had a problem deploying to polaris-react-pr-1024 February 12, 2019 17:25 Failure
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 12, 2019 17:28 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 12, 2019 17:32 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 12, 2019 17:40 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 12, 2019 17:52 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 12, 2019 18:00 Inactive
@AndrewMusgrave
Copy link
Member

AndrewMusgrave commented Feb 12, 2019

Are we sure this is something we want to fix? I believe this is fixed in chrome v73, @tmlayton I heard you might have checked the canary release?

@mbaumbach
Copy link
Contributor

I see this bug in Version 74.0.3705.0 (Official Build) canary (64-bit) on the Shopify Partner app specific summary page, which makes heavy use of vertical stacks, as well as the code sandbox provided in #947. Though I'm not sure if that's the appropriate browser version to be looking at and may still be fixed in v73.

@solonaarmstrong-zz
Copy link
Author

solonaarmstrong-zz commented Feb 14, 2019

Chrome v72

screen shot 2019-02-14 at 2 36 31 pm

Chrome v73

screen shot 2019-02-14 at 2 37 31 pm

Canary v74.0.3705.0

screen shot 2019-02-14 at 2 40 58 pm

It was fixed and broke again?

@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 14, 2019 22:48 Inactive
@mbaumbach
Copy link
Contributor

Weird, maybe it was hotfixed into v73 and hasn't been merged it into canary yet for some reason?

@mehdi-loup
Copy link
Contributor

Just to add to the issue, I can see the problem with a button group in a card. The proposed changes would fix the problem.
ezgif-4-eabe4e4602a4

My chrome version being 72.0.3626.109 (Official Build) (64-bit)

@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 19, 2019 21:59 Inactive
@AndrewMusgrave
Copy link
Member

Sorry I got my versions wrong, it looks like Tim tested it on canary v74.

@solonaarmstrong-zz
Copy link
Author

@AndrewMusgrave I have a screenshot for canary v74

@ry5n
Copy link
Contributor

ry5n commented Feb 21, 2019

@solonaarmstrong Can you confirm this works (and doesn’t cause other issues) on supported browsers (including other desktop and mobile browsers than Chrome)? If so I think you’re right to encourage reviewers to look at this so we can ship a fix.

@solonaarmstrong-zz
Copy link
Author

solonaarmstrong-zz commented Feb 21, 2019

@ry5n Here are some more screenshots of other browsers. I don't have context on why the margin would be needed for vertical stacks otherwise. @dleroux apparently does? I might need to migrate my machine before being able to fire up VirtualBox. (No idea why it says Bell Wifi. I wish!)

screen shot 2019-02-21 at 7 09 32 am

Safari

screen shot 2019-02-21 at 7 09 48 am

iOS (Safari)

img_1306

iOS (Firefox)

img_d37644bf5d7c-1

iOS (Chrome)

img_1309

@mateus
Copy link
Member

mateus commented Feb 27, 2019

👋 Hey, just to catch up. Do we have any updates on this fix? I'm working on a redesigned version of the Payment Settings and we have this happening in quite a few pages. Is this issue not happening in many other places?

@chloerice
Copy link
Member

chloerice commented Feb 28, 2019

👋 Hey, just to catch up. Do we have any updates on this fix? I'm working on a redesigned version of the Payment Settings and we have this happening in quite a few pages. Is this issue not happening in many other places?

Hey @mateus, I've tophatted these changes in web and the issue (in Chrome only) is still there. I believe it's only because the .vertical class is defined above the spacing prop classes and they are still adding unwanted margin. I'll pick up where Solona left off, stay tuned.

@chloerice chloerice self-assigned this Feb 28, 2019
@chloerice chloerice removed their request for review February 28, 2019 16:25
@chloerice chloerice force-pushed the stack-vertical-margin branch from 8735d52 to d66f6a3 Compare February 28, 2019 18:53
@ghost ghost added the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label Feb 28, 2019
@BPScott BPScott temporarily deployed to polaris-react-pr-1024 February 28, 2019 18:54 Inactive
@chloerice
Copy link
Member

Quick update - I tested the changes with the .vertical class moved below the spacing prop classes and it works as expected across browsers again 🎉

Before After
screen shot 2019-03-01 at 11 31 42 am screen shot 2019-02-28 at 12 41 03 pm

@ry5n ry5n self-requested a review March 1, 2019 18:34
Copy link
Contributor

@ry5n ry5n left a comment

Choose a reason for hiding this comment

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

Sounds like this is working now. :shipit:

Copy link
Member

@mateus mateus left a comment

Choose a reason for hiding this comment

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

Tested it by simply copying the proposed CSS over to the project and it seems to work as expected 👍 Thank you.

@chloerice chloerice force-pushed the stack-vertical-margin branch from d66f6a3 to 88297dd Compare March 4, 2019 20:30
@chloerice chloerice merged commit e7a4eb8 into master Mar 4, 2019
@mateus mateus deleted the stack-vertical-margin branch March 4, 2019 21:26
@amrocha amrocha temporarily deployed to production March 7, 2019 22:06 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-needed Added by a bot. Contributor needs to sign the CLA Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants