Skip to content

Media Placeholder: Change media URL input type to allow a local URL path #29138

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

Merged
merged 1 commit into from
Sep 7, 2021
Merged

Media Placeholder: Change media URL input type to allow a local URL path #29138

merged 1 commit into from
Sep 7, 2021

Conversation

skierpage
Copy link
Contributor

@skierpage skierpage commented Feb 19, 2021

Description

Change type of block-editor-media-placeholder__url-input-field from "url" to "text."

input type="url" makes the browser require a full URL of at least urlscheme:restofurl, which means you can't enter a local urlpath for an image like /path/to/image.jpg without scheme and host. With this change the media-placeholder URL input field matches the url-input component which uses type="text".

How has this been tested?

Making this change in Firefox's developer tools' HTML inspector fixes issue #20903, but I haven't tested the code change.

Screenshots

Types of changes

Bug fix, should fix #20903.

Checklist:

(I have never made a pull request to Gutenberg, I hope this proposed fix doesn't waste anyone's time.)

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation. It might be useful to mention why type="url" should not be used but I don't know if or how you can put a comment in a component definition.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

input type="url" makes the browser require a full URL of at least _urlscheme_::_restofurl_, which means you can't enter a local urlpath like `/path/to/image.jpg`. This change matches the [url-input component](https://github.com/WordPress/gutenberg/blob/70b1cde3bcf186059f0e4ee7396717046b96569b/packages/block-editor/src/components/url-input/index.js#L422) which uses type="text".

I think this would fix issue #20903.
@skierpage skierpage requested a review from ellatrix as a code owner February 19, 2021 09:58
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Feb 19, 2021
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @skierpage! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@skorasaurus skorasaurus added the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label Feb 24, 2021
Copy link
Contributor

@stokesman stokesman left a comment

Choose a reason for hiding this comment

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

I've tested this and it resolves the issue. 👍

Base automatically changed from master to trunk March 1, 2021 15:45
@Mamaduka Mamaduka added the [Type] Enhancement A suggestion for improvement. label Sep 7, 2021
@Mamaduka Mamaduka changed the title change media URL input field to allow a local URL path Media Placeholder: Change media URL input type to allow a local URL path Sep 7, 2021
@Mamaduka Mamaduka merged commit 1f80940 into WordPress:trunk Sep 7, 2021
@github-actions
Copy link

github-actions bot commented Sep 7, 2021

Congratulations on your first merged pull request, @skierpage! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 11.5 milestone Sep 7, 2021
@Mamaduka
Copy link
Member

Mamaduka commented Sep 7, 2021

Thanks for working on this, @skierpage, and congratulation on your first merged PR 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

you can't insert a site-local image URL
4 participants