Skip to content

Commit

Permalink
Fix Navigation link control overlapping issue (#59065)
Browse files Browse the repository at this point in the history
* Fix nagivation link control overlapping issue

* Addressed feedback

* use variable insted fixed number in spacing
  • Loading branch information
akasunil authored Feb 22, 2024
1 parent c62690f commit 5860993
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import { useCopyToClipboard } from '@wordpress/compose';
import { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';
import { Icon, globe, info, linkOff, edit, copySmall } from '@wordpress/icons';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
import { useDispatch } from '@wordpress/data';
import { useDispatch, useSelect } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
Expand All @@ -33,6 +34,12 @@ export default function LinkPreview( {
hasUnlinkControl = false,
onRemove,
} ) {
const showIconLabels = useSelect(
( select ) =>
select( preferencesStore ).get( 'core', 'showIconLabels' ),
[]
);

// Avoid fetching if rich previews are not desired.
const showRichPreviews = hasRichPreviews ? value?.url : null;

Expand Down Expand Up @@ -139,7 +146,7 @@ export default function LinkPreview( {
label={ sprintf(
// Translators: %s is a placeholder for the link URL and an optional colon, (if a Link URL is present).
__( 'Copy link%s' ), // Ends up looking like "Copy link: https://example.com".
isEmptyURL ? '' : ': ' + value.url
isEmptyURL || showIconLabels ? '' : ': ' + value.url
) }
ref={ ref }
disabled={ isEmptyURL }
Expand Down
9 changes: 9 additions & 0 deletions packages/block-editor/src/components/link-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ $block-editor-link-control-number-of-actions: 1;
content: attr(aria-label);
}
}

.block-editor-link-control__search-item-top {
gap: $grid-unit-10;

.components-button.has-icon {
min-width: inherit;
width: min-content;
}
}
}
}

Expand Down

1 comment on commit 5860993

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 5860993.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8002434833
📝 Reported issues:

Please sign in to comment.