diff --git a/assets/stylesheets/_z-index.scss b/assets/stylesheets/_z-index.scss
index 85b0099665715d..27d6a864d5ec5c 100644
--- a/assets/stylesheets/_z-index.scss
+++ b/assets/stylesheets/_z-index.scss
@@ -68,9 +68,9 @@ $z-layers: (
// but bellow #adminmenuback { z-index: 100 }
".edit-post-sidebar {greater than small}": 90,
- // Show notices below expanded wp-admin submenus:
- // #adminmenuwrap { z-index: 9990 }
- ".components-notice-list": 9989,
+ // Show notices below expanded editor bar
+ // .edit-post-header { z-index: 30 }
+ ".components-notice-list": 29,
// Show modal under the wp-admin menus and the popover
".components-modal__screen-overlay": 100000,
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 9e3643db94c675..1000097841b981 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 7.0.3 (Unreleased)
+
+### Polish
+
+- The `Notice` component will now always include the `.components-notice-list` class.
+
## 7.0.2 (2018-11-22)
## 7.0.1 (2018-11-21)
diff --git a/packages/components/src/notice/list.js b/packages/components/src/notice/list.js
index 4ff12e2a451181..dcb39dc49b5828 100644
--- a/packages/components/src/notice/list.js
+++ b/packages/components/src/notice/list.js
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
+import classnames from 'classnames';
import { noop, omit } from 'lodash';
/**
@@ -18,9 +19,11 @@ import Notice from './';
* @param {Object} $0.children Array of children to be rendered inside the notice list.
* @return {Object} The rendered notices list.
*/
-function NoticeList( { notices, onRemove = noop, className = 'components-notice-list', children } ) {
+function NoticeList( { notices, onRemove = noop, className, children } ) {
const removeNotice = ( id ) => () => onRemove( id );
+ className = classnames( 'components-notice-list', className );
+
return (
{ children }
diff --git a/packages/components/src/notice/test/list.js b/packages/components/src/notice/test/list.js
new file mode 100644
index 00000000000000..034ff9b7dfd828
--- /dev/null
+++ b/packages/components/src/notice/test/list.js
@@ -0,0 +1,26 @@
+/**
+ * External dependencies
+ */
+import ShallowRenderer from 'react-test-renderer/shallow';
+
+/**
+ * WordPress dependencies
+ */
+import TokenList from '@wordpress/token-list';
+
+/**
+ * Internal dependencies
+ */
+import NoticeList from '../list';
+
+describe( 'NoticeList', () => {
+ it( 'should merge className', () => {
+ const renderer = new ShallowRenderer();
+
+ renderer.render(
);
+
+ const classes = new TokenList( renderer.getRenderOutput().props.className );
+ expect( classes.contains( 'is-ok' ) ).toBe( true );
+ expect( classes.contains( 'components-notice-list' ) ).toBe( true );
+ } );
+} );
diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index 5a4018bc9dd1b6..d2d8c28f01d9b1 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -80,7 +80,8 @@ function Layout( {
aria-label={ __( 'Editor content' ) }
tabIndex="-1"
>
-
+
+
diff --git a/packages/edit-post/src/components/layout/style.scss b/packages/edit-post/src/components/layout/style.scss
index 0cd4a03af0dfeb..c9a116468a2797 100644
--- a/packages/edit-post/src/components/layout/style.scss
+++ b/packages/edit-post/src/components/layout/style.scss
@@ -13,22 +13,28 @@
color: $dark-gray-900;
@include break-small {
- position: fixed;
- top: inherit;
+ top: 0;
}
- .components-notice {
- margin: 0 0 5px;
- padding: 6px 12px;
- min-height: $panel-header-height;
+ // Non-dismissible notices.
+ &.is-pinned.is-pinned {
+ position: relative;
+ left: 0;
+ top: 0;
+ }
+ }
- .components-notice__dismiss {
- margin: 10px 5px;
- }
+ .components-notice {
+ margin: 0 0 5px;
+ padding: 6px 12px;
+ min-height: $panel-header-height;
+
+ .components-notice__dismiss {
+ margin: 10px 5px;
}
}
- // on mobile, toolbars behave differently
+ // On mobile, toolbars behave differently.
@include break-small {
padding-top: $header-height;
}
@@ -38,7 +44,7 @@
padding-top: $block-controls-height;
}
- // on mobile, toolbars behave differently
+ // On mobile, toolbars behave differently.
@include break-small {
padding-top: $header-height + $block-toolbar-height;
@@ -53,9 +59,6 @@
}
}
-@include editor-left(".components-notice-list");
-@include editor-right(".components-notice-list");
-
.edit-post-layout__metaboxes:not(:empty) {
border-top: $border-width solid $light-gray-500;
margin-top: 10px;
@@ -79,10 +82,14 @@
padding-bottom: 0;
}
- // On mobile the main content area has to scroll otherwise you can invoke
- // the overscroll bounce on the non-scrolling container, causing
- // (ノಠ益ಠ)ノ彡┻━┻
- overflow-y: auto;
+ // On mobile the main content (html or body) area has to scroll.
+ // If, like we do on the desktop, scroll an element (.edit-post-layout__content) you can invoke
+ // the overscroll bounce on the non-scrolling container, causing for a frustrating scrolling experience.
+ // The following rule enables this scrolling beyond the mobile breakpoint, because on the desktop
+ // breakpoints scrolling an isolated element helps avoid scroll bleed.
+ @include break-small() {
+ overflow-y: auto;
+ }
-webkit-overflow-scrolling: touch;
// This rule ensures that if you've scrolled to the end of a container,
diff --git a/packages/editor/src/components/editor-notices/index.js b/packages/editor/src/components/editor-notices/index.js
index f11c76181cbb56..f899f4a61e0ff2 100644
--- a/packages/editor/src/components/editor-notices/index.js
+++ b/packages/editor/src/components/editor-notices/index.js
@@ -1,3 +1,8 @@
+/**
+ * External dependencies
+ */
+import { filter } from 'lodash';
+
/**
* WordPress dependencies
*/
@@ -10,10 +15,16 @@ import { compose } from '@wordpress/compose';
*/
import TemplateValidationNotice from '../template-validation-notice';
-function EditorNotices( props ) {
+export function EditorNotices( { dismissible, notices, ...props } ) {
+ if ( dismissible !== undefined ) {
+ notices = filter( notices, { isDismissible: dismissible } );
+ }
+
return (
-
-
+
+ { dismissible !== false && (
+
+ ) }
);
}
diff --git a/packages/editor/src/components/editor-notices/test/index.js b/packages/editor/src/components/editor-notices/test/index.js
new file mode 100644
index 00000000000000..655a990aa174fe
--- /dev/null
+++ b/packages/editor/src/components/editor-notices/test/index.js
@@ -0,0 +1,35 @@
+/**
+ * External dependencies
+ */
+import { shallow } from 'enzyme';
+
+/**
+ * Internal dependencies
+ */
+import { EditorNotices } from '../';
+
+describe( 'EditorNotices', () => {
+ const notices = [
+ { content: 'Eat your vegetables!', isDismissible: true },
+ { content: 'Brush your teeth!', isDismissible: true },
+ { content: 'Existence is fleeting!', isDismissible: false },
+ ];
+
+ it( 'renders all notices', () => {
+ const wrapper = shallow( );
+ expect( wrapper.prop( 'notices' ) ).toHaveLength( 3 );
+ expect( wrapper.children() ).toHaveLength( 1 );
+ } );
+
+ it( 'renders only dismissible notices', () => {
+ const wrapper = shallow( );
+ expect( wrapper.prop( 'notices' ) ).toHaveLength( 2 );
+ expect( wrapper.children() ).toHaveLength( 1 );
+ } );
+
+ it( 'renders only non-dismissible notices', () => {
+ const wrapper = shallow( );
+ expect( wrapper.prop( 'notices' ) ).toHaveLength( 1 );
+ expect( wrapper.children() ).toHaveLength( 0 );
+ } );
+} );