Problem/Motivation

Typing drupal.org or example.com as the link will result in

<a href="drupal.org>something</a>

That's an invalid link.

Steps to reproduce

See above.

Proposed resolution

Default schemeless links to https:// using https://ckeditor.com/docs/ckeditor5/latest/features/link.html#adding-def...

Resulting UX:

Remaining tasks

Review.

User interface changes

Schemeless links get https:// prefixed automatically.

API changes

None.

Data model changes

None.

Release notes snippet

When typing URLs like "example.com/interesting-page", the missing protocol (https://) will be added automatically.

CommentFileSizeAuthor
#23 link-default-protocol.gif77.5 KBWim Leers

Issue fork drupal-2893568

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lee.cocklin created an issue. See original summary.

lee.cocklin’s picture

Issue summary: View changes
anon’s picture

Project: Linkit » Drupal core
Version: 8.x-5.0-beta5 » 8.4.x-dev
Component: Code » ckeditor.module
Category: Bug report » Feature request

This is rather an issue of the default Drupal Link plugin. Linkit only extends that.

Wim Leers’s picture

Title: Links without protocol set as internal » URLs with top-level domain but without protocol should get a protocol added automatically
Component: ckeditor.module » editor.module
Category: Feature request » Task
Issue tags: +Usability

Thanks, @anon, for moving this to Drupal core's issue queue.

This is clearly a usability problem. We could add some detection logic in \Drupal\editor\Form\EditorLinkDialog::submitForm(), to automatically prefix the URL with a protocol: http:// or https://. But which of the two? How can we reliably guess? Should we perform a request?

The developer answer would be "just type the protocol", but that's of course not very usable. Not sure yet how to proceed here.

anon’s picture

I didn't even think about the http vs https. That is a hard one.

Just to perform a request wouldn't be a 100% solution. Both protocol can exists at the same time, and even link to two different targets.

To force the user to add the protocol if the "link" seems like a URI is not an option either in my mind, as entity URIs actually can be something like /www.something.com as in (http:example.com/www.something.com)

Wim Leers’s picture

Agreed with every one of your points!

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ainarend’s picture

Version: 8.6.x-dev » 8.8.x-dev

Stumbled upon this today via a client request.

Could a possible solution be that we don't force either http or https, but we simply add '//' and making it a protocol-relative URL, so forcing the browser to use whichever protocol was used to load the page.

Just tested it and it resolved the issue of having /google.com links and now instead the browser itself managed to do the proper protocol detection and created a correct link.

This should fix the site builder/editor's problem for 99% of the cases if i am not missing something.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Matroskeen’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

AaronBauman’s picture

I think we're overthinking it here.
* There's a huge SEO penalty for http:
* Nearly every website will resolve over https
* When not a single browser requires users to type a protocol, this is already a significant usability problem

Seems like "default to https" would be a good enough solution for 9/10 cases, and if it doesn't work the user can manually enter http:// to fix it.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

chucksimply’s picture

#17 - exactly

gagarine’s picture

"Let's overengineering" is the tagline of Drupal.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Wim Leers’s picture

Title: URLs with top-level domain but without protocol should get a protocol added automatically » Linking in CKEditor 5: URLs with top-level domain but without protocol should get a protocol added automatically
Component: editor.module » ckeditor5.module
Priority: Normal » Major
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Needs product manager review
FileSize
77.5 KB

Definitively outdated since #3306584: [11.x] Remove EditorLinkDialog, EditorImageDialog and EditorMediaDialog in Drupal 11.

But … also still an issue with CKEditor 5. I just tried it and was able to reproduce the same problem.

Fortunately, they have infrastructure in place that makes it easy to achieve this: https://ckeditor.com/docs/ckeditor5/latest/features/link.html#adding-def...

This is so absurdly low-hanging fruit that I immediately created a merge request and screencast for it. It's 2 lines of code. IMHO it doesn't even need tests, because the CKEditor 5 team obviously is testing this already.

AaronBauman’s picture

Status: Needs review » Reviewed & tested by the community

That's great, thanks for the MR.
Surprised ckeditor doesn't have a default value in the first place, and agree that it would be silly to add test coverage for a 3rd party library.

Anyone know if there's a similar issue open for the link widget already?
That's another super annoying UX / validation constraint when protocol is missing.

  • nod_ committed e84fc608 on 11.x
    Issue #2893568 by Wim Leers, lee.cocklin, AaronBauman, anon, ainarend:...

  • nod_ committed dd1af507 on 10.3.x
    Issue #2893568 by Wim Leers, lee.cocklin, AaronBauman, anon, ainarend:...

nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Fixing a 7 years old issue is nice, especially with a diff that's 4 lines

Committed e84fc60 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.