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

Fix overflows of Navigator #35310

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions packages/components/src/navigator/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,29 @@ function NavigatorButton( { path, isBack = false, ...props } ) {
}

const MyNavigation = () => (
<NavigatorProvider initialPath="/">
<NavigatorScreen path="/">
<p>This is the home screen.</p>
<NavigatorButton isPrimary path="/child">
Navigate to child screen.
</NavigatorButton>
</NavigatorScreen>
<div style={ { 'overflow-x': 'hidden' } }>
<NavigatorProvider initialPath="/">
<NavigatorScreen path="/">
<p>This is the home screen.</p>
<NavigatorButton isPrimary path="/child">
Navigate to child screen.
</NavigatorButton>
</NavigatorScreen>

<NavigatorScreen path="/child">
<p>This is the child screen.</p>
<NavigatorButton isPrimary path="/" isBack>
Go back
</NavigatorButton>
</NavigatorScreen>
</NavigatorProvider>
<NavigatorScreen path="/child">
<p>This is the child screen.</p>
<NavigatorButton
isPrimary
path="/"
isBack
style={ { position: 'sticky', top: '5px' } }
>
Go back
</NavigatorButton>
<div style={ { height: '200vh', background: 'papayawhip' } } />
</NavigatorScreen>
</NavigatorProvider>
</div>
);

export const _default = () => {
Expand Down
38 changes: 21 additions & 17 deletions packages/edit-post/src/components/preferences-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ export default function PreferencesModal() {
);
} else {
modalContent = (
<Card isBorderless>
<CardBody>
<NavigatorProvider initialPath="/">
<NavigatorScreen path="/">
<NavigatorProvider initialPath="/">
<NavigatorScreen path="/">
<Card isBorderless size="small">
<CardBody>
<ItemGroup>
{ tabs.map( ( tab ) => {
return (
Expand Down Expand Up @@ -358,13 +358,17 @@ export default function PreferencesModal() {
);
} ) }
</ItemGroup>
</NavigatorScreen>
{ sections.map( ( section ) => {
return (
<NavigatorScreen
key={ `${ section.name }-menu` }
path={ section.name }
>
</CardBody>
</Card>
</NavigatorScreen>
{ sections.map( ( section ) => {
return (
<NavigatorScreen
key={ `${ section.name }-menu` }
path={ section.name }
>
<Card isBorderless size="large">
<CardBody>
<NavigationButton
path="/"
icon={
Expand All @@ -376,12 +380,12 @@ export default function PreferencesModal() {
</NavigationButton>
<h2>{ section.tabLabel }</h2>
{ section.content }
</NavigatorScreen>
);
} ) }
</NavigatorProvider>
</CardBody>
</Card>
</CardBody>
</Card>
</NavigatorScreen>
);
} ) }
</NavigatorProvider>
);
}
return (
Expand Down
44 changes: 3 additions & 41 deletions packages/edit-post/src/components/preferences-modal/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,19 @@ $vertical-tabs-width: 160px;
height: 70%;
}

// Clears spacing to flush fit the navigation component to the modal edges.
// Clears spacing to flush fit the navigator component to the modal edges.
@media (max-width: #{ ($break-medium - 1) }) {
.components-modal__content {
padding: 0;
// Prevents horizontal overflow from showing scrollbars.
overflow-x: hidden;

&::before {
content: none;
}
}
}

.components-navigation {
padding: 0;
max-height: 100%;
overflow-y: auto;
color: $black;

> * {
// Matches spacing cleared from the modal content element.
padding: $grid-unit-30 $grid-unit-40;
}

.components-navigation__menu {
margin: 0;

.components-navigation__item {
& > button {
padding: 3px $grid-unit-20;
height: $grid-unit-60;
// Aligns button text instead of button box.
margin: 0 #{-$grid-unit-20};
width: calc(#{$grid-unit-40} + 100%);
&:focus {
font-weight: 500;
}
}
}
.components-navigation__menu-title-heading {
border-bottom: 1px solid $gray-300;
padding-left: 0;
padding-right: 0;
}
.components-navigation__back-button {
padding-left: 0;
}
.edit-post-preferences-modal__custom-fields-confirmation-button {
width: auto;
}
}
}

.edit-post-preferences__tabs {
.components-tab-panel__tabs {
position: absolute;
Expand Down
6 changes: 6 additions & 0 deletions packages/edit-site/src/components/sidebar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
}
}

.edit-site-global-styles-sidebar {
> .components-panel {
overflow-x: hidden;
}
}

.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon {
margin-left: 0;
}
Expand Down