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

Use checkbox for Open in new tab within Link Control #50961

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { ToggleControl, VisuallyHidden } from '@wordpress/components';
import { CheckboxControl, VisuallyHidden } from '@wordpress/components';

const noop = () => {};

Expand All @@ -19,7 +19,7 @@ const LinkControlSettings = ( { value, onChange = noop, settings } ) => {
};

const theSettings = settings.map( ( setting ) => (
<ToggleControl
<CheckboxControl
__nextHasNoMarginBottom
className="block-editor-link-control__setting"
key={ setting.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ $preview-image-height: 140px;
.block-editor-link-control__setting {
margin-bottom: $grid-unit-20;

// Cancel left margin inherited from WP Admin Forms CSS.
input {
margin-left: 0;
}

&.block-editor-link-control__setting:last-child {
margin-bottom: 0;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/e2e-tests/specs/editor/various/links.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe( 'Links', () => {

// Toggle should still have focus and be checked.
await page.waitForSelector(
':focus:checked.components-form-toggle__input'
':focus:checked.components-checkbox-control__input'
);

// Ensure that the contents of the post have not been changed, since at
Expand Down Expand Up @@ -539,7 +539,9 @@ describe( 'Links', () => {

// Confirm that focus was not prematurely returned to the paragraph on
// a changing value of the setting.
await page.waitForSelector( ':focus.components-form-toggle__input' );
await page.waitForSelector(
':focus.components-checkbox-control__input'
);

// Submit link. Expect that "Open in new tab" would have been applied
// immediately.
Expand Down