Skip to content

Make notices push down content - #13614

Merged
jasmussen merged 3 commits into
masterfrom
try/restore-notices-push-content
Feb 14, 2019
Merged

jasmussen merged 3 commits into
masterfrom
try/restore-notices-push-content

Conversation

@jasmussen

Copy link
Copy Markdown
Contributor

This PR restores the good stuff from #12301. That is: it allows notices to push down content. Dismissible notices are sticky at the top, non-dismisible notices scroll out of view.

This is mostly an exact copy of the other PR, but fresh. The behavior has a number of benefits:

  • If you have multiple non-dismissible notices, you can still actually use the editor.
  • Notices no longer cover the scrollbar.
  • Notices no longer cover the permalink interface.
  • Notices now only cover content if you do not dismiss the notices.

Fixes #7276.

GIFs:

desktop

mobile

screenshot 2019-01-31 at 11 58 01

@jasmussen jasmussen added [Type] Enhancement A suggestion for improvement. [Package] Notices /packages/notices labels Jan 31, 2019
@jasmussen jasmussen self-assigned this Jan 31, 2019
@jasmussen
jasmussen requested review from a team, aduth and youknowriad January 31, 2019 11:00
@jasmussen

Copy link
Copy Markdown
Contributor Author

Please read also review points on #12301, as some of them still apply.

@jasmussen

Copy link
Copy Markdown
Contributor Author

This also mitigates the situation in https://core.trac.wordpress.org/ticket/46098#comment:6.

@mapk mapk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This worked great for me. Both dismissible and non-dismissible notices performed as expected. The scrolling of content behind dismissible notices, but not behind non-dismissible notices was a good experience.

@jasmussen jasmussen added this to the 5.1 (Gutenberg) milestone Feb 5, 2019
@jasmussen
jasmussen requested a review from a team February 5, 2019 08:13
@jasmussen

Copy link
Copy Markdown
Contributor Author

Nice, thank you. I put this in a milestone and expanded the review range for a code review.

@aduth

aduth commented Feb 8, 2019

Copy link
Copy Markdown
Member

In Firefox, I see an issue at the medium range viewport size (~970px).

Using: [ ...Array( 3 ) ].forEach( () => wp.data.dispatch( 'core/notices' ).createInfoNotice( 'Not dismissible', { isDismissible: false } ) )

image

This PR restores the good stuff from #12301. That is: it allows notices to push down content. Dismissible notices are sticky at the top, non-dismisible notices scroll out of view.

This is mostly an exact copy of the other PR, but fresh. The behavior has a number of benefits:

- If you have multiple non-dismissible notices, you can still actually use the editor.
- Notices no longer cover the scrollbar.
- Notices no longer cover the permalink interface.
- Notices now only cover content if you do not dismiss the notices.
@jasmussen

Copy link
Copy Markdown
Contributor Author

Noticed an issue with this branch that isn't fixed:

cover sticky

Notice how the sticky notice covers the block toolbar.

However, compare to master:

master

It's even worse there.

For that reason, I feel like it would still be good to ship this as an improvement.

@jasmussen

Copy link
Copy Markdown
Contributor Author

Looking into the issue, thanks Andrew. It's not Firefox specific, it's because of the top toolbar.

@jasmussen

Copy link
Copy Markdown
Contributor Author

Solid catch, Andrew. Turns out there was a lot of old cruft there that was vestigial and could be killed entirely. So the most recent commit should fix issues even in master:

breakpoints

I think this should be good for a final review.

jasmussen pushed a commit that referenced this pull request Feb 12, 2019
This PR tries to add additional animation when the sidebar open/closes. Specifically, it now animates the right-margin in lockstep with the sidebar opening and closing. This causes the main body content to animate, just like the sidebar, for a nicer experience.

However in order to be performant, this means we add `will-change: transform;` to the .edit-post__layout-content`. This is causing an issue with the notices, which will be moot when #13614 gets merged, so *this PR is dependant on that landing first*.

Secondly, although it's a small PR, the addition of the will-change property is likely going to need a lot of testing so it doesn't cause regressions. Things to look for are absolute, fixed, or sticky position elements and the like. In my own testing, only the notices regressed which as mentioned gets fixed when 13614 lands. But this will still need a lot of eyes.

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This works great across all variations I could think to throw at it (dismissible, viewport size, editor sidebar toggle, admin sidebar collapse, scrollable content). 👍

}

// Non-dismissible notices.
&.is-pinned.is-pinned {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need the .is-pinned to be duplicated here (specificity)? It'd be preferable if we didn't, or could find another way to override the intended "base" styles.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could swear it was needed, but perhaps it was needed earlier on in the development process, and as things were cleaned up it became unnecessary. In any case I tried removing the extra specificity (yes, cool new trick I learned) and it doesn't seem to have any negative effects.

@kjellr kjellr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me too. Tested with a variety of different notifications and editor scenarios. 👍

@jasmussen

Copy link
Copy Markdown
Contributor Author

Thanks all for the reviews, I think this is good to go when the checks pass.

@jasmussen
jasmussen merged commit 6991141 into master Feb 14, 2019
@jasmussen
jasmussen deleted the try/restore-notices-push-content branch February 14, 2019 06:22
@irishetcher

Copy link
Copy Markdown

That would be an improvement. It's a bit jarring to have the title covered. Thanks for letting me know.

youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* Make notices push down content

This PR restores the good stuff from #12301. That is: it allows notices to push down content. Dismissible notices are sticky at the top, non-dismisible notices scroll out of view.

This is mostly an exact copy of the other PR, but fresh. The behavior has a number of benefits:

- If you have multiple non-dismissible notices, you can still actually use the editor.
- Notices no longer cover the scrollbar.
- Notices no longer cover the permalink interface.
- Notices now only cover content if you do not dismiss the notices.

* Address top toolbar issues.

* Remove the overly specific is-pinned.
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* Make notices push down content

This PR restores the good stuff from #12301. That is: it allows notices to push down content. Dismissible notices are sticky at the top, non-dismisible notices scroll out of view.

This is mostly an exact copy of the other PR, but fresh. The behavior has a number of benefits:

- If you have multiple non-dismissible notices, you can still actually use the editor.
- Notices no longer cover the scrollbar.
- Notices no longer cover the permalink interface.
- Notices now only cover content if you do not dismiss the notices.

* Address top toolbar issues.

* Remove the overly specific is-pinned.
This was referenced Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Notices /packages/notices [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants