-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Refactor PostVisibility to use Popover component #1204
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
Conversation
| </div> | ||
| { visibilityOptions.map( ( { value, label, info, onSelect, checked } ) => ( | ||
| <label key={ value } className="editor-post-visibility__dialog-label"> | ||
| <span className="editor-post-visibility__button-wrapper"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Majority of changes here are simply to wrap the button and Popover in a span to which a position: relative; style is applied, allowing the Popover to position itself within (necessary since div is not a valid child of button).
Using something like react-portal could allow us to be less particular about the DOM structure or relative positioning. Portals are apparently supported in React 16 out-of-the-box, but I am not sure if they are documented yet.
a109f6c to
dc1caca
Compare
|
Rebased to resolve conflicts. This would be a good one to move forward on because we're having to deal with many implementation-specific requirements that would be good to consolidate (e.g. click outside, blur, etc). |
dc1caca to
9c459cc
Compare
|
@jasmussen I just rebased the branch, and am unable to reproduce. Could you try deleting your local copy and giving it another go? If you're still having trouble, could you let me know which browser / version you're using? |
Codecov Report
@@ Coverage Diff @@
## master #1204 +/- ##
=======================================
Coverage 20.34% 20.34%
=======================================
Files 135 135
Lines 4237 4237
Branches 722 722
=======================================
Hits 862 862
Misses 2843 2843
Partials 532 532
Continue to review full report at Codecov.
|
|
I now see no diff. between master and this branch. Which sounds like a success criteria, so 👍 👍! I do see this, though: But I see that also in master, and it seems to be related to #2059 |
|
Currently this should only affect the visibility popover, not the date picker, but it's intended to be part of a series toward consolidating patterns to a common component (similar to DropDownMenu, #1880). I'll plan to merge this one after today's release and address schedule popover in a subsequent pull request. |
|
👍👍 |
Necessary to avoid popover bounds exceed detectino from flipping inserter, moving it off-screen in mobile.
9c459cc to
5a58688
Compare
|
In testing on mobile, I found that the inserter popover was not behaving correctly, but then I noticed the same in master. It appears that our logic for calculating the height of the inserter content was never updated when we added tabs to the inserter. This is accounted for in 5a58688. |



Related: #1193
This pull request seeks to extend generalized
Popoverbehavior from #1193, refactoringPostVisibilityto make use of the common component in place of its specific implementation. Refactoring will continue in subsequent pull requests to also revise thePostSchedulecomponent. The changes here required some additional effort to improvePopoverto be less specific to theInserteruse-case.Implementation notes:
The
Popovercomponent now renders content within a nesteddiv. The reason for this is to allow the root node to be 0px by 0px, positioned absolutely at the edge relative to the parent in which it is rendered. This ensures that the arrow is always shown exactly at the anchor point, and content is adjusted per the desired direction.Design Notes:
Some design changes were necessary to better serve general Popover usage. Previously the left-bound inserter in post content had extended further to the left. Attempting to mirror this in the sidebar visibility dialog proved to exceed the page boundaries, so it was brought tighter in line with the node to which the dialog is anchored. Additionally, the editor header inserter Popover no longer opens anchored to the "+" icon but instead centered to the entire "+ Insert" button text.
Testing instructions:
While this pull request is targeted at
PostVisibility, due to refactoring of thePopovercomponent, additional testing should be done on the Inserter (small and large viewports) to ensure that no regressions have been introduced.Repeat testing instructions from #1193.
Verify that the Post Visibility dialog appears and behaves more-or-less identical as it does in the master branch.
Follow-up Tasks:
onClickOutsidebehavior toPopover, accepting anonCloseprop handler