As a result of the commit from the parent issue, slides with a blank alt attribute in the thumbnail navigation will not appear. This is because the regex looks for one or more characters in the alt attribute, and if it's empty then it thinks the rest of the img tag until the next set of quotes is the alt text, causing incorrect HTML to be displayed (or rather, not displayed).

Here's an example of the issue for the following images (first works, second doesn't):

<img src="[SNIP]/files/styles/flexslider_full/public/images/canopycreekautumn.jpg" alt="sdf" title="sdf">
$attributes['data-thumb-alt'] = sdf
HTML output: <li data-thumb="[SNIP]/files/styles/flexslider_full/public/images/canopycreekautumn.jpg" data-thumb-alt="sdf"><img src="[SNIP]/files/styles/flexslider_full/public/images/canopycreekautumn.jpg" width="800" height="500" alt="sdf" title="sdf" /></li>

<img src="[SNIP]/files/styles/flexslider_full/public/images/calm_0.jpg" alt="" title="">
$attributes['data-thumb-alt'] = " title=
HTML output: <li data-thumb="[SNIP]/files/styles/flexslider_full/public/images/calm_0.jpg" data-thumb-alt="&quot; title="><img src="[SNIP]/files/styles/flexslider_full/public/images/calm_0.jpg" width="800" height="500" alt="" title="" /></li>

The fix is to replace the + with an * in the alt regex.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BWPanda created an issue. See original summary.

BWPanda’s picture

Status: Active » Needs review
FileSize
589 bytes

  • amaria committed 6b12030 on 7.x-2.x authored by BWPanda
    Issue #2837171 by BWPanda: ALT attribute for thumbnails causes issues
    
amaria’s picture

Status: Needs review » Fixed

Nice catch again! Committed. Thanks!

Status: Fixed » Closed (fixed)

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

kyberman’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
FileSize
602 bytes

The same problem is inside current D8 version, thanks @BWPanda for simple patch.

Attaching almost identical patch for 8.x-2.0-beta1 and 8.x-2.x-dev, please reopen and merge, thank you.

tacituseu’s picture

Confirming on 8.x-2.0-beta1.

@kyberman: Please file a new issue for 8.x-2.x-dev otherwise this wont be noticed.