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

Remove Popover from LinkControl component #19638

Merged
merged 3 commits into from
Jan 14, 2020

Conversation

youknowriad
Copy link
Contributor

We should be able to use LinkControl outside of Popover.

Testing instructions

  • Check that the buttons and navigation block still work as intended. (url assigning)

@youknowriad youknowriad self-assigned this Jan 14, 2020
@youknowriad youknowriad added [Type] Code Quality Issues or PRs that relate to code quality [Block] Buttons [Block] Navigation Affects the Navigation Block labels Jan 14, 2020
} ) }
onClose={ () => setIsLinkOpen( false ) }
/>
<Popover>
Copy link
Member

Choose a reason for hiding this comment

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

Does it not need a position here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seemed to work without it, maybe it was the default, I'll check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I restored this

Copy link
Member

@ellatrix ellatrix left a comment

Choose a reason for hiding this comment

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

className={ classnames( 'block-editor-link-control', className ) }
onClose={ closeLinkUI }
position="bottom center"
focusOnMount="firstElement"
Copy link
Member

Choose a reason for hiding this comment

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

Are these props no longer needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They seem unnecessary in my testing.

return;
}

function ConnectedLinkControl( props ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like that I had to do that to make unit tests pass (test the unconnected component). Ideally, we'd find a way to easily mock useSelect

Copy link
Member

Choose a reason for hiding this comment

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

I don't like that I had to do that to make unit tests pass (test the unconnected component). Ideally, we'd find a way to easily mock useSelect

Follow-up at #19705

label: label || escape( newTitle ),
opensInNewTab: newOpensInNewTab,
} ) }
onClose={ () => setIsLinkOpen( false ) }
Copy link
Member

Choose a reason for hiding this comment

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

This should have been moved to the Popover. LinkControl no longer has an onClose prop with the changes from this pull request.

Fix at: #19885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Block] Navigation Affects the Navigation Block [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