-
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
Add Unlink button to LinkControl popover #32541
Conversation
Size Change: +249 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
9bcc0f6
to
0d3c2e3
Compare
@javierarce This is now ready for review. |
packages/block-editor/src/components/link-control/test/index.js
Outdated
Show resolved
Hide resolved
This works fine, but the hover state has border around the link, and the active state color is blue (with a border, too). I think there shouldn't be any border and those states should use a darker red. I'm using macOS Big Sur, and tested this branch with Chrome, Firefox, and Safari. Strangely, in Safari the active state is red. |
@javierarce Thanks for your review 🤝
I'm pretty sure this focus state is there for a11y reasons. Here's another example of it being used on a link: Aesthetically I'm with you on this, but I'd be concerned that we'd be compromising the experience for users who rely on that focus state to be consistent. Let me know if you think we can still safetly go ahead with this change?
~ I think we could get away with this color change. Let me adjust things.~ I spoke too soon! Having looked into the base CSS rules on the gutenberg/packages/components/src/button/style.scss Lines 174 to 202 in 79e02a2
Also worth noting that the focus style will only show if/when a user uses keyboard to focus the button. Pointer / touch based devices will simply hover and click. The hover state is red. Let me know your thoughts on this. |
@kevin940726 Are you happy to 👍 this one? It won't be merged until after @javierarce approves Design wise. |
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.
Sure, looks good :). Just a small nitpick.
@getdave You are totally right about the borders. The color and and the lack of border-radius of the first one looked strange to me and didn't make the connection with the style of the accessible links. And regarding the colors… I agree with you too, let's use the current convention. |
Description
In #31464 we discovered that the rich preview can occasionally obscure the
Unlink
item in the block toolbar.As
<Popover>
is not aware of the block toolbar, @javierarce suggested adding anUnlink
button to the<LinkControl>
UI would be a good compromise.Here is the design for the unlink UI provided by @javierarce which is PR implements:
This PR
is a WIP whichimplements that. For reasons of backwards compatibility it does this via the introduction of a newonRemove
property which when passed will:Unlink
button to be shown in the<LinkControl>
's UI.Unlink
button is clicked.As the consumer of
<LinkControl>
must ensure that the handler passed asonRemove
will remove the currentvalue
of<LinkControl>
we have made theonRemove
prop opt-in in order that other uses of<LinkControl>
both within and outside of Core will not be effected.However, this PR does add this
Unlink
behaviour for the format library implementation which means that paragraph and rich text will receive this functionality by default.In addition, the default
onChange
handler for the format library has been updated so that when it is called withnull
it treats this as a signal to remove the link.We need to consider:
@wordpress/format-library
where it consumes<LinkControl>
to ensure it actually works.<LinkControl>
will not expectnull
as the value of<LinkControl>
and thus we may need to make this an opt in feature or fix all the instances in Core we're in control of.How has this been tested?
Unlink
button in the bottom corner of the UI.Now check it doesn't appear in other uses of
<LinkControl>
within Core. For example the Nav block.Screenshots
Screen.Capture.on.2021-06-29.at.11-39-23.mov
Types of changes
Non breaking change.
Checklist:
*.native.js
files for terms that need renaming or removal).