That’s not how that component works.
onRemove
is called when the link is unlinked, via a button that only appears when certain conditions are met:
{ onRemove && value && ! isEditingLink && ! isCreatingPage && (
<Button
className="block-editor-link-control__unlink"
isDestructive
variant="link"
onClick={ onRemove }
>
{ __( 'Unlink' ) }
</Button>
) }
When an onRemove
props is given, and the value is not empty, the link is not being edited, and you’re not currently using the control to create a page.
This isn’t so that you can erase or reset the value of the link, this is so that you can remove it completely. It is possible to have <a href="">
, but unlink
would remove the anchor completely, so it does not make sense for you to use.
Instead, to catch the blank URL use case, you should watch the change event