Problem/Motivation

I got a PHP Manual external links in Date & Time Format section. If you click on the link It will be opened in the same window. Problem is after choosing the php date & time format I have to click on the browser back button to come again my Drupal site.

Currently has $description = $this->t('A user-defined date format. See the <a href="http://php.net/manual/function.date.php">PHP manual</a> for available options.');

Proposed resolution

I think, If the link would be opened in new tab then user can see the php date & time manual and add the date & time format easily.

Like-
$description = $this->t('A user-defined date format. See the <a href="http://php.net/manual/function.date.php" target="_blank">PHP manual</a> for available options.');

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

imrancluster created an issue. See original summary.

imrancluster’s picture

suraj1074’s picture

FileSize
2.07 KB

The patch does not apply. Even when i create the same patch by manually doing the change. I created the .diff extension file it applies. I am a newbie am i doing any error?

Status: Needs review » Needs work

The last submitted patch, 3: mypatch.diff, failed testing.

himanshugautam’s picture

FileSize
4.34 KB
imrancluster’s picture

@suraj1074
If you have drupal core 8.1.x installed then this patch should be run. You can clone using the following url-
git clone --branch 8.1.x https://git.drupal.org/project/drupal.git

After creating the patch I use the following command to apply the patch with 8.1.x branch. It worked for me.
git apply -v [patchname.patch]

himanshugautam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: Target_blank_added-2652272-2.patch, failed testing.

mallezie’s picture

Issue tags: +Needs backport to D7

The patch applies cleanly, and works as announced.
However this only fixes the links to the date php settings. When looking through drupal core, there are lot's of places a link to an external site (mostly drupal.org / php.net and wikipedia) are shown. (For example status report page). Should we be able to fix those in one go?
This probably needs some grep magic to find them all. Some are to http / https sites, and contained in the a tag, others are escaped, and the link is added afterwards.

imrancluster’s picture

@mallezie Yes we can.

Actually I am new in contributing world :)
This is my first very small patch, you know :(, I have no commit for Drupal core or any contrib modules.
But I am interested and learning how to contribute right way

vishwac9’s picture

Status: Needs work » Fixed

Changing the bug status to fixed, the patch works well ! Just to ask have you committed your local code after applying the patch.

imrancluster’s picture

@vishwac9 I commited in my laptop, but I didn't push to live 8.1.x. I have no idea about this.

Should I push my commit to live branch?

vishwac9’s picture

@imrancluster we cannot push back to the core. It would be taken care by the core team. Actually, my answer was intended to suraj1074 sorry for the confusion :)

mallezie’s picture

Status: Fixed » Needs review
imrancluster’s picture

@mallezie

Here is a updated patch. I updated for the all following external urls-

php.net
en.wikipedia
www.drupal
ckeditor.com
www.w3.org

Status: Needs review » Needs work

imrancluster’s picture

Target-_blank-attribute-add-to-to-external-links-2652272-15.patch

This patch worked for my 8.1.x. I don't know, why this test pass was failed.

wiifm’s picture

Before we go ahead and break most translatable strings in Drupal, has anyone done some research as to why this is a good idea?

From reading https://css-tricks.com/use-target_blank/ it comes up with clear examples on when target=_blank should be used. A blanket "internal and external" rule seems to make little sense.

Keen to hear some more justification on this. Also, if this is restricted to just where places where it makes the most sense, can this be targeted at 8.0.x ?

Saphyel’s picture

Assigned: Unassigned » Saphyel
Saphyel’s picture

Saphyel’s picture

Assigned: Saphyel » Unassigned

Status: Needs review » Needs work
bhavikshah9’s picture

I think, it is too big to be done in one shot. It will be very difficult to debug why patch failed, because there are many files involved.
Let's chunk it into pieces with one issue for each module. Remaining files can be grouped into one last shot.
Would like to hear feedback on this.

lomasr’s picture

Title: Target="_blank" attribute add to to external links. » Target="_blank" attribute add to external links.

Grammer correction in the title.

lomasr’s picture

Assigned: Unassigned » lomasr
lomasr’s picture

Issue tags: +drupalconasia2016
lomasr’s picture

Assigned: lomasr » Unassigned
Neelanjana Das’s picture

Neelanjana Das’s picture

Assigned: Unassigned » Neelanjana Das
Status: Needs work » Needs review

Status: Needs review » Needs work
imrancluster’s picture

I think, to take decision for this issue will be more difficult. When I created this issue I found some external links. I don't know the actual philosophy of external url usages. Now I am realizing If we apply target attribute for external urls what will be the action for like apple tabs and other smart devices.

We should think both device's behavior. I'm a new person, so I don't know what will be happening for this issue.

Neelanjana Das’s picture

Assigned: Neelanjana Das » Unassigned
SwapS’s picture

Assigned: Unassigned » SwapS

@imrancluster : Don't really have to worry about its behavior on different devices as its suppose to be behavior is clearly defined here.

@Neelanjana Das : We don't really need to have a JS snippet for this implementation. Please user target=_blank instead.

Cheers,
SwapS.

SwapS’s picture

Assigned: SwapS » Unassigned

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

timhtheos’s picture

Version: 8.2.x-dev » 8.1.x-dev
Status: Needs work » Needs review
FileSize
1.97 KB

I just reload the latest passed patch against 8.1.x-dev.

SwapS’s picture

Patch on #37 looks good.
Works as expected for Date module fixes.

Also , as suggested by @bhavikshah9 ; we should create separate issues for fixing it for other module (should have one primary ticket to track it to closure.)

Cheers,
SwapS.

imrancluster’s picture

@SwapS
That will be good. I created a patch for all modules, for some external sites. See #15
That's why the patch was failed. :(

catch’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Needs usability review

This is generally discouraged - there's plenty of ways to open a link in a tab. Tagging for an issue summary update as to why we'd do this vs. letting people choose, and for usability review.

yoroy’s picture

I don't think we've defined a standard for this. It is generally discouraged indeed. How many of these kinds of links are there in core?

The real solution for the specific case of setting a date format would be a better UI for it that doesn't rely on external documentation to make it work. Something more than a single text field :)

Cameron Tod’s picture

mpdonadio’s picture

Hopefully @Bojhan will hop into this as we were just discussing this in IRC.

The problem is that core isn't consistent in how target=_blank is used. I don't think a blanket "all external links should open in new windows" is appropriate.

I would propose that we use this for all external links when a link is used on a form / wizard, or anywhere else user input may be lost when they navigate to a new page. I also think that in addition to target=_blank, we should add rel=external to them for improved accessibility for devices that grok this.

For sanity, I would be in favor of scoping the issues to links out to a particular site, but not by module. So, we rescope this issue to be all links out to php.net and then evaluate other sites (any maybe one issue to mop up the one-offs).

I will update the IS later with arguments for both sites.

#41, that is really unfeasible as the link is related to custom date formatters where you need to know the PHP syntax / placeholder codes; there are already standard formatters that are user-friendly. There are a decent number of these links in core out to external resources, but not a ton.

yoroy’s picture

I'd say having to know the PHP syntax / placeholder codes to set a custom date format is the unfeasible part of this user interface :)

For sanity, I would be in favor of scoping the issues to links out to a particular site

That makes sense to me too.

jhodgdon’s picture

So. It seems like there are two questions/issues here:

a) For Date/Time formatting, is it possible we could provide either a better UI or some documentation in the page, so that someone could do a custom date format without linking to php.net?

b) In general, we have links in our UI text that go to either drupal.org, php.net, or wikipedia.org (and maybe other places, but I think those three are the most common). We have no standard saying that they should or shouldn't automatically open in a different tab. Should we have a standard about it, and what should it be? Note that we need to consider accessibility and usability both when deciding on this standard. I do not know if target _blank is considered OK for accessibility.

Anyway... I don't know if we should be trying to resolve both of these on this one issue. But it seems like for (b) we need to decide on a standard and then apply it everywhere in Core. For (a) the issue would be just in the date module.

lokapujya’s picture

b.) Please do not make links that open a new browser window. That's what right click->open in new browser is for.

jhodgdon’s picture

I kind of agree with you, but... how do you right click on a phone? I suppose it is something like long-press/choose from options. I don't do much browsing on my phone.

mpdonadio’s picture

#45-a, that page las a lot of options. A lot. I am not sure if we could make it concise enough to be usable for when you have a need for a custom formatter, especially when there are a slew of standard ones.

#45-b, I am hesitant to make an issue about standardizing this. It will win Bikeshed-of-the-Year. But, I think it needs to be done.

jhodgdon’s picture

I think that this particular issue should be just about the Date stuff, and we should open a separate one about _blank in general (even though the title of this one sounds generic, the discussion has mostly been about Date).

mgifford’s picture

Issue tags: +tooltip
Related issues: +#2207383: Create a tooltip component

The accessibility pieces are essentially about user control. Opening up a new page to direct folks to a new page can be disorienting. It's a much better practice to teach users how to use their browser. It's really hard for some users to handle multiple screens (especially on a mobile device) even the browser has good support for them.

Some related resources:
https://css-tricks.com/use-target_blank/
https://developer.mozilla.org/en-US/docs/Web/API/Window/open#Do_not_use_...
http://alistapart.com/article/popuplinks

I wonder if adding a tooltip might be a better pattern here. Just to alert them that this is going outside of their Drupal site.

mpdonadio’s picture

mgifford’s picture

Bojhan’s picture

Issue tags: -Needs usability review
xjm’s picture

Version: 8.1.x-dev » 8.3.x-dev

As a string change, this change would need to be targeted for the development minor, which is currently 8.3.x-dev.

lokapujya’s picture

Reading this again, I think in my comment in #46 that I thought this was generic and maybe didn't realize it was for one specific page. Also, since it's an external page (and we open all external pages on the Babson Portal sites in a new tab), I'm less against it now.

Furthermore, the external page is a reference/help for the opening page.

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.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.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.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.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.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.

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.

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.

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.