If you're using a form containing mollom and accidentally click on the mollom image, all form content is lost due to the link to the mollom page.

There are modules like extlink that add target _blank for external links. But this is javascript.
I know there's a lot of debate about not using target _blank on "modern" sites, but shouldn't we be some kind of more friendly to users?

What are the recommendations for this issue?

Comments

miro_dietiker’s picture

Issue tags: +Accessibility

accessibility tag

dave reid’s picture

The target attribute is invalid in XHTML. I'm open to hearing ideas on how to solve this.

Should we maybe just not link to Mollom on the CAPTCHA itself? Is there a reason we do it that way? I wouldn't think the CAPTCHA image would itself be a link.

dries’s picture

We could remove the link.

dave reid’s picture

Yeah I think that's the best approach. Especially since people have to click on the audio captcha to get it to play, if people happen to randomly click on the image captcha (I admit, I randomly click *all the time*), I wouldn't expect to be taken away from the form. Once I re-roll #788968: Simplify the JS and captcha-fetching code for D6 and get that in to both branches, this will be an easy change. :)

miro_dietiker’s picture

Title: Target for link on mollom captcha image » remove link on mollom captcha image - avoid loss of form content

Changing issue title. This solution will be fine for us.

dave reid’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.05 KB

Here's the patch to un-link the image captcha in D7.

miro_dietiker’s picture

Looks fine to me.

dries’s picture

Status: Needs review » Needs work

Looks broken to me but the tests don't catch it.

+++ mollom.module	6 May 2010 17:06:25 -0000
@@ -1637,8 +1637,8 @@ function mollom_get_captcha($type, array
-        $output .= '<img src="' . check_plain(url($response['url'])) . '" alt="Mollom CAPTCHA" />';
-        $output = '<a href="http://mollom.com" class="mollom-captcha-content mollom-image-captcha">' . $output . '</a>';
+        $captcha = theme('image', array('path' => url($response['url']), 'alt' => t('Mollom CAPTCHA'), 'getsize' => FALSE));
+        $output = '<span class="mollom-captcha-content mollom-image-captcha">' . $output . '</span>';
         $output .= ' (<a href="#" class="mollom-switch-captcha mollom-audio-captcha">' . t('play audio CAPTCHA') . '</a>)';

- Shouldn't we use $captcha instead of $output in the first $output (statement with the span)?

- I'm not sure the switch to theme_image() is necessary.

dave reid’s picture

Status: Needs work » Needs review

First part is def. a bug. I should probably add some tests to ensure that the actual Only local images are allowed. tag is generated properly. What do you think Dries?

I put in theme_image() because it just seems odd that we're not using the APIs when we should be. I guess the case could be made that we don't want this HTML to ever be overridable, in which case we can call theme_image() directly.

dave reid’s picture

Fixed the bug.

dries’s picture

I suggest we extend the following two asserts to also check for the img-tag.

 /**
  * Assert that the CAPTCHA field is found on the current page.
  */
 protected function assertCaptchaField() {
   $this->assertFieldByXPath('//input[@type="text"][@name="mollom[captcha]"]', '', 'CAPTCHA field found.');
 }

 /**
  * Assert that the CAPTCHA field is not found on the current page.
  */
 protected function assertNoCaptchaField() {
   $this->assertNoFieldByXPath('//input[@type="text"][@name="mollom[captcha]"]', '', 'CAPTCHA field not found.');
 }
dave reid’s picture

Added the xpath assertions for img[@alt="Mollom CAPTCHA"] to the two functions listed above.

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, 768710-mollom-unlink-image-captcha-D7.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
Issue tags: +Accessibility
dries’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed to CVS HEAD. Needs to be backported to Drupal 6.

dries’s picture

Status: Patch (to be ported) » Fixed

Backported to DRUPAL-6--1 and committed directly.

Status: Fixed » Closed (fixed)
Issue tags: -Accessibility

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

  • Commit 08e17e8 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #768710 by Dave Reid: remove link on mollom captcha image -...

  • Commit 08e17e8 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #768710 by Dave Reid: remove link on mollom captcha image -...