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

Navigator: Remove overflow styles from NavigatorScreen #44973

Merged
merged 2 commits into from
Oct 14, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import type { ForwardedRef } from 'react';
// eslint-disable-next-line no-restricted-imports
import { motion, MotionProps } from 'framer-motion';
import { css } from '@emotion/react';

/**
* WordPress dependencies
*/
import { focus } from '@wordpress/dom';
import { useContext, useEffect, useMemo, useRef } from '@wordpress/element';
import { useContext, useEffect, useRef } from '@wordpress/element';
import {
useReducedMotion,
useMergeRefs,
Expand All @@ -27,7 +26,6 @@ import {
useContextSystem,
WordPressComponentProps,
} from '../../ui/context';
import { useCx } from '../../utils/hooks/use-cx';
import { View } from '../../view';
import { NavigatorContext } from '../context';
import type { NavigatorScreenProps } from '../types';
Expand Down Expand Up @@ -57,21 +55,6 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {

const previousLocation = usePrevious( location );

const cx = useCx();
const classes = useMemo(
() =>
cx(
css( {
// Ensures horizontal overflow is visually accessible.
overflowX: 'auto',
// In case the root has a height, it should not be exceeded.
maxHeight: '100%',
} ),
className
),
[ className, cx ]
);

// Focus restoration
const isInitialLocation = location.isInitial && ! location.isBack;
useEffect( () => {
Expand Down Expand Up @@ -128,7 +111,7 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {
return (
<View
ref={ mergedWrapperRef }
className={ classes }
className={ className }
{ ...otherProps }
>
{ children }
Expand Down Expand Up @@ -174,7 +157,7 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {
return (
<motion.div
ref={ mergedWrapperRef }
className={ classes }
className={ className }
{ ...otherProps }
{ ...animatedProps }
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,6 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
}

.emotion-2 {
overflow-x: auto;
max-height: 100%;
}

.emotion-3 {
background-color: #fff;
color: #1e1e1e;
position: relative;
Expand All @@ -522,47 +517,47 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
border-radius: calc(2px - 1px);
}

.emotion-5 {
.emotion-4 {
height: 100%;
}

.emotion-7 {
.emotion-6 {
box-sizing: border-box;
height: auto;
max-height: 100%;
padding: calc(4px * 4);
}

.emotion-7:first-of-type {
.emotion-6:first-of-type {
border-top-left-radius: calc(2px - 1px);
border-top-right-radius: calc(2px - 1px);
}

.emotion-7:last-of-type {
.emotion-6:last-of-type {
border-bottom-left-radius: calc(2px - 1px);
border-bottom-right-radius: calc(2px - 1px);
}

.emotion-9 {
.emotion-8 {
border-radius: 2px;
}

.emotion-9>*:first-of-type>* {
.emotion-8>*:first-of-type>* {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}

.emotion-9>*:last-of-type>* {
.emotion-8>*:last-of-type>* {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}

.emotion-11 {
.emotion-10 {
width: 100%;
display: block;
}

.emotion-13 {
.emotion-12 {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
Expand All @@ -579,18 +574,18 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
border-radius: 2px;
}

.emotion-13:hover {
.emotion-12:hover {
color: var( --wp-admin-theme-color, #007cba);
}

.emotion-13:focus {
.emotion-12:focus {
background-color: transparent;
color: var( --wp-admin-theme-color, #007cba);
border-color: var( --wp-admin-theme-color, #007cba);
outline: 3px solid transparent;
}

.emotion-15 {
.emotion-14 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
Expand All @@ -609,26 +604,26 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
width: 100%;
}

.emotion-15>* {
.emotion-14>* {
min-width: 0;
}

.emotion-17 {
.emotion-16 {
display: block;
max-height: 100%;
max-width: 100%;
min-height: 0;
min-width: 0;
}

.emotion-19 {
.emotion-18 {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.emotion-47 {
.emotion-46 {
background: transparent;
display: block;
margin: 0!important;
Expand All @@ -648,7 +643,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
}

@media ( prefers-reduced-motion: reduce ) {
.emotion-47 {
.emotion-46 {
transition-duration: 0ms;
}
}
Expand Down Expand Up @@ -701,60 +696,60 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
data-wp-component="NavigatorProvider"
>
<div
class="emotion-2 components-navigator-screen"
class="components-navigator-screen"
data-wp-c16t="true"
data-wp-component="NavigatorScreen"
style="opacity: 0; transform: translateX(50px) translateZ(0);"
>
<div
class="components-surface components-card emotion-3 emotion-1"
class="components-surface components-card emotion-2 emotion-1"
data-wp-c16t="true"
data-wp-component="Card"
>
<div
class="emotion-5 emotion-1"
class="emotion-4 emotion-1"
>
<div
class="components-card__body components-card-body emotion-7 emotion-1"
class="components-card__body components-card-body emotion-6 emotion-1"
data-wp-c16t="true"
data-wp-component="CardBody"
>
<div
class="components-item-group emotion-9 emotion-1"
class="components-item-group emotion-8 emotion-1"
data-wp-c16t="true"
data-wp-component="ItemGroup"
role="list"
>
<div
class="emotion-11"
class="emotion-10"
role="listitem"
>
<button
class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
data-wp-c16t="true"
data-wp-component="NavigatorButton"
id="general"
>
<div
class="components-flex components-h-stack emotion-15 emotion-1"
class="components-flex components-h-stack emotion-14 emotion-1"
data-wp-c16t="true"
data-wp-component="HStack"
>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
<span
class="components-truncate emotion-19 emotion-1"
class="components-truncate emotion-18 emotion-1"
data-wp-c16t="true"
data-wp-component="Truncate"
>
General
</span>
</div>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
Expand All @@ -775,35 +770,35 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
</button>
</div>
<div
class="emotion-11"
class="emotion-10"
role="listitem"
>
<button
class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
data-wp-c16t="true"
data-wp-component="NavigatorButton"
id="blocks"
>
<div
class="components-flex components-h-stack emotion-15 emotion-1"
class="components-flex components-h-stack emotion-14 emotion-1"
data-wp-c16t="true"
data-wp-component="HStack"
>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
<span
class="components-truncate emotion-19 emotion-1"
class="components-truncate emotion-18 emotion-1"
data-wp-c16t="true"
data-wp-component="Truncate"
>
Blocks
</span>
</div>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
Expand All @@ -824,35 +819,35 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
</button>
</div>
<div
class="emotion-11"
class="emotion-10"
role="listitem"
>
<button
class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
data-wp-c16t="true"
data-wp-component="NavigatorButton"
id="panels"
>
<div
class="components-flex components-h-stack emotion-15 emotion-1"
class="components-flex components-h-stack emotion-14 emotion-1"
data-wp-c16t="true"
data-wp-component="HStack"
>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
<span
class="components-truncate emotion-19 emotion-1"
class="components-truncate emotion-18 emotion-1"
data-wp-c16t="true"
data-wp-component="Truncate"
>
Panels
</span>
</div>
<div
class="components-flex-item emotion-17 emotion-1"
class="components-flex-item emotion-16 emotion-1"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
Expand All @@ -877,13 +872,13 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
</div>
<div
aria-hidden="true"
class="components-elevation emotion-47 emotion-1"
class="components-elevation emotion-46 emotion-1"
data-wp-c16t="true"
data-wp-component="Elevation"
/>
<div
aria-hidden="true"
class="components-elevation emotion-47 emotion-1"
class="components-elevation emotion-46 emotion-1"
data-wp-c16t="true"
data-wp-component="Elevation"
/>
Expand Down