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

Refactor the MediaReplaceFlow component to use Dropdown #19126

Merged
merged 6 commits into from
Dec 16, 2019

Conversation

youknowriad
Copy link
Contributor

Some code quality tweaks to the MediaReplaceFlow component.

I'd appreciate reviews to check whether the component is still working as intended.

@youknowriad youknowriad self-assigned this Dec 13, 2019
@youknowriad youknowriad added the [Type] Code Quality Issues or PRs that relate to code quality label Dec 13, 2019
allowedTypes={ allowedTypes }
render={ ( { open } ) => (
<Toolbar className={ 'media-replace-flow components-dropdown-menu' }>
<Dropdown
Copy link
Member

Choose a reason for hiding this comment

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

There is also this DropdownMenu component. Ou of curiosity, why isn’t it a good fit? We clearly need a ToolbarGroup which is collapsible and renders as button with menu. @diegohaz started some explorations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason it's not a DropdownMenu is because it contains elements that are not menu items (the URL input). There's some discussion about this in the original PR.

Copy link
Member

Choose a reason for hiding this comment

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

Right, I'm personally wondering whether there should be any menu items used in this popover in that case. It might be a bit confusing for VoiceOver users.

@youknowriad
Copy link
Contributor Author

@talldan @draganescu Any one able to test if this is still working as intended?

@draganescu
Copy link
Contributor

draganescu commented Dec 16, 2019

Hi @youknowriad great PR, I tested this and it works nicely! I think this approach is better, can't say exactly why I settled on Popover but the flow has been through many iterations and (as you mentioned) some things required some refactoring of the core components at some stages of these iterations.

In this stage a dropdown (not a dropdown-menu sinch this is more than a menu) is the perfect choice.

There is a small difference in the roundness of the edit URL input:

Screenshot 2019-12-16 at 11 27 05

In master the URL looks like this:

Screenshot 2019-12-16 at 11 26 57

I am unsure if this is a problem.

Copy link
Contributor

@draganescu draganescu left a comment

Choose a reason for hiding this comment

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

There are some small issues.

  1. The z-index of the dropdown is higher than the media library:

Screenshot 2019-12-16 at 11 32 46

  1. There is a weird second outline around the edit URL button:

Screenshot 2019-12-16 at 11 33 01

Other than this visual issues, functionality is the same for me.

@youknowriad
Copy link
Contributor Author

I can't reproduce the z-index issue.

@draganescu
Copy link
Contributor

@youknowriad I tested in Firefox:

media-replace-z-index

// Changing the z-index of Popovers have wider implications.
.modal-open .block-editor-media-replace-flow__options {
display: none;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah excellent solution! :)

@draganescu
Copy link
Contributor

@youknowriad the two problems are solved but now there is a too wide gap in the url editor between the input and the button.

Screenshot 2019-12-16 at 13 23 22

versus

Screenshot 2019-12-16 at 13 23 22

I think @mapk tweaked it quite a bit in the previous PR.

@youknowriad youknowriad merged commit 903df27 into master Dec 16, 2019
@youknowriad youknowriad deleted the update/media-replace-flow branch December 16, 2019 12:18
@youknowriad youknowriad added this to the Gutenberg 7.2 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants