What
When using LinkControl (e.g., in Navigation blocks), typing a URL like wordpress.org or www.wordpress.org and pressing Enter does not auto-prepend https:// to the URL. The URL is saved as-is without a protocol.
Current behavior:
- Type
wordpress.org → Press Enter → Saves as wordpress.org
- Type
www.wordpress.org → Press Enter → Saves as www.wordpress.org
Expected behavior:
- Type
wordpress.org → Press Enter → Should save as https://wordpress.org
- Type
www.wordpress.org → Press Enter → Should save as https://www.wordpress.org
This works correctly when selecting a suggestion from the dropdown (the search handler calls prependHTTPS), but fails when directly submitting without selecting a suggestion.
Why
URLs without protocols are invalid and won't work as links. The Buttons block test explicitly verifies this behavior should work (see test/e2e/specs/editor/blocks/buttons.spec.js lines 134-142), and PR #75005 updated the codebase to use https as the default protocol.
This creates an inconsistent UX where:
- Selecting a suggestion: URL gets prepended with
https:// ✅
- Pressing Enter directly: URL stays as-is without protocol ❌
The Button block is unaffected because it has a workaround in get-updated-link-attributes.js that calls prependHTTPS() separately. However, Navigation blocks and other blocks using LinkControl are affected.
How
The issue is in packages/block-editor/src/components/link-control/search-input.js line 164.
When submitting without a suggestion, the code passes:
onSuggestionSelected( hasSuggestion || { url: value } );
It should call prependHTTPS() on the value:
import { prependHTTPS } from '@wordpress/url';
// In onSubmit handler:
onSuggestionSelected( hasSuggestion || { url: prependHTTPS( value ) } );
This matches how the search handler's handleDirectEntry function already works in use-search-handler.js line 44.
User Stories
As a user creating a navigation menu, I want to type wordpress.org and have it automatically saved as https://wordpress.org, so my links work correctly without requiring me to remember the protocol.
As a user, I want consistent behavior whether I select a suggestion from the dropdown or press Enter directly, so I don't have to think about which method properly formats my URL.
What
When using LinkControl (e.g., in Navigation blocks), typing a URL like
wordpress.orgorwww.wordpress.organd pressing Enter does not auto-prependhttps://to the URL. The URL is saved as-is without a protocol.Current behavior:
wordpress.org→ Press Enter → Saves aswordpress.orgwww.wordpress.org→ Press Enter → Saves aswww.wordpress.orgExpected behavior:
wordpress.org→ Press Enter → Should save ashttps://wordpress.orgwww.wordpress.org→ Press Enter → Should save ashttps://www.wordpress.orgThis works correctly when selecting a suggestion from the dropdown (the search handler calls
prependHTTPS), but fails when directly submitting without selecting a suggestion.Why
URLs without protocols are invalid and won't work as links. The Buttons block test explicitly verifies this behavior should work (see
test/e2e/specs/editor/blocks/buttons.spec.jslines 134-142), and PR #75005 updated the codebase to usehttpsas the default protocol.This creates an inconsistent UX where:
https://✅The Button block is unaffected because it has a workaround in
get-updated-link-attributes.jsthat callsprependHTTPS()separately. However, Navigation blocks and other blocks using LinkControl are affected.How
The issue is in
packages/block-editor/src/components/link-control/search-input.jsline 164.When submitting without a suggestion, the code passes:
It should call
prependHTTPS()on the value:This matches how the search handler's
handleDirectEntryfunction already works inuse-search-handler.jsline 44.User Stories