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

[Navigation.Section] Prevent rollup from collapsing when sub nav and on mobile #1417

Merged
merged 3 commits into from May 7, 2019

Conversation

tmlayton
Copy link
Contributor

@tmlayton tmlayton commented May 6, 2019

WHY are these changes introduced?

Fixes #1004

WHAT is this pull request doing?

Prevents the rollup from collapsing when an item clicked has sub nav and at the mobile breakpoint

Before After
rollup bug prevent rollup

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, Navigation} from '../src';

interface State {}

export default class Playground extends React.Component<{}, State> {
  render() {
    return (
      <Page title="Playground">
        <Navigation location="/">
          <Navigation.Section
            rollup={{
              after: 1,
              view: 'view',
              hide: 'hide',
              activePath: '/',
            }}
            items={[
              {
                url: '/path/to/place',
                label: 'Home',
                icon: 'home',
              },
              {
                url: '/path/to/place',
                label: 'Orders',
                icon: 'orders',
                badge: '15',
              },
              {
                url: '/path/to/place',
                label: 'Products',
                icon: 'products',
                subNavigationItems: [
                  {
                    url: '/path/to/place',
                    label: 'Foo',
                  },
                  {
                    url: '/path/to/place',
                    label: 'Bar',
                  },
                  {
                    url: '/path/to/place',
                    label: 'Baz',
                  },
                ],
              },
            ]}
          />
        </Navigation>
      </Page>
    );
  }
}

🎩 checklist

@BPScott BPScott temporarily deployed to polaris-react-pr-1417 May 6, 2019 23:05 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1417 May 6, 2019 23:11 Inactive
@chloerice
Copy link
Member

chloerice commented May 7, 2019

Hey Tim, thanks for working on this!! I just tophatted in web and it doesn't seem to have fixed the issue. I thought it might just be a caching issue on my phone so I started a new session in an incognito window and it's still the same. Can you try this branch in web and see if it works for you?

** Edit: Got more context from @lemonmade and tophatted with his branch in web and all is well ✅

Copy link
Member

@chloerice chloerice left a comment

Choose a reason for hiding this comment

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

Tophatted these changes in https://github.com/Shopify/web/pull/11323 and it works 🎉 :shipit:

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

Successfully merging this pull request may close these issues.

Navigation rollup always collapses when section heading is clicked
3 participants