-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Improve LinkControl preview #57775
Improve LinkControl preview #57775
Conversation
Size Change: +2.62 kB (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@getdave I'd appreciate help with tests here when you get a few. 🙇 |
Looks good! |
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.
I'm concerned about removing the Opens in new tab
prematurely.
It was added as a stopgap whilst we worked on other solutions to allow immediate access to the link settings following initial creation.
We have other PRs which will remove the Opens in new tab
setting whilst also providing a new UX to achieve the same result. Removing it in this PR without providing a alternative is going to regress the experience for some users.
My opinion is that we should not do it in this PR.
We could also consider retaining the rich image preview if the mime type is an image. This PR shows how we could access the mime-type data to determine if the linked resource is an image. |
How confident are you in getting #57726 in? Would having that resolve this concern? |
@richtabor Removal of the
No because that PR still shows a preview after creation. It's the next step after that that will unblock this. |
This reverts commit 33491f0.
I added it back. We can follow up once those other dependencies are merged. |
Flaky tests detected in cd5bba4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7572082385
|
@@ -191,6 +191,9 @@ $preview-image-height: 140px; | |||
overflow-wrap: break-word; | |||
|
|||
.block-editor-link-control__search-item-info { | |||
color: $gray-700; |
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.
This does meet AA level for normal text, but fails at AAA. It is pretty hard to read at this color at such a small text size. Could we increase the contrast here?
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.
@@ -257,6 +257,7 @@ function InlineLinkUI( { | |||
onClose={ stopAddingLink } | |||
onFocusOutside={ () => stopAddingLink( false ) } | |||
placement="bottom" | |||
offset={ 8 } |
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.
I prefer the previous offset that gave it a little bit more separation from the link, but not a sticking point for me.
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.
@@ -41,7 +41,7 @@ export default function LinkPreview( { | |||
const hasRichData = richData && Object.keys( richData ).length; |
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.
Do we still need hasRichData
? It adds an .is-rich
class, but that class is unused in the CSS.
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.
Oh, looks like it was only ever used for tests. Not going to rip that out right now.
@@ -2244,7 +2244,8 @@ describe( 'Rich link previews', () => { | |||
|
|||
const titlePreview = screen.getByText( selectedLink.title ); | |||
|
|||
expect( titlePreview ).toHaveClass( | |||
// eslint-disable-next-line testing-library/no-node-access | |||
expect( titlePreview.parentElement ).toHaveClass( |
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.
The test was failing because now we have an extra span wrapping the title in the preview because we are using <Truncate>
. I don't know how to do this more cleanly! In all honesty, this same test file does this in another instance in the same way.
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.
🚢
This PR also seems to have affected the
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @jeryj, @jasmussen, @t-hamano. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Closes #53654 by reducing the weight of the link previews, encouraging focus on the primary actions of editing and unlinking. Also, with the addition of #57726, the link popover will stay open upon creating a link—that popover shouldn't cover so much content.
Note that "Open in a new tab" is still in this preview. However with #57726 and #50892 on the horizon, when creating a link, you'll have access to all link editing controls right off, so we can remove it after.
Testing Instructions
Screenshots or screencast
Follow ups:
We would need to follow up once #57726 and #50892 are completed, to remove the new tab control from the preview: