I wanted to replace the spans with a figure and figcaption. Using a figure instead of an inherently inline element like a span seemed more semantic and appropriate. Yay for HTML5!

I'll upload the patch shortly.

Comments

Amy Brown’s picture

Status: Active » Needs review
StatusFileSize
new3.5 KB

Replaced both spans (and their now unnecessary inline styles) with figure and figcaption HTML5 elements. Also reminified JS.

Figure/figcaption W3C: http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-f...

themusician’s picture

The patch looks good to me. It replaces the spans with figures and figcaptions which Amy Brown points out is more of a valid approach with the adoption of HTML5.

For those testing the patch, one you apply it, do not forget to clear the cache on your site.

Does the patch need to be rerolled without the minified JS?

themusician’s picture

StatusFileSize
new49.78 KB

Here is an updated patch that applies the styles users set in their WYSIWYG to the figure element. The original patch was missing that piece.

For example, if a user chose to float an image to the left, the original patch would insert that style in the class attribute area of the element. This now inserts it into the style attribute.

themusician’s picture

StatusFileSize
new673 bytes

There were a few white space errors on the previous patch. This one is good to go.

themusician’s picture

StatusFileSize
new4.37 KB

My goodness. I was accidentally creating a patch against the non-existent master branch creating odd patch files. Sorry for cluttering up the queue.

Amy Brown’s picture

theMusician's final patch seems to do the trick. Figures will float according to how to image floats/if the user assigns it a float in WYSIWYG.

themusician’s picture

StatusFileSize
new4.01 KB

This version of the patch is compatible with http://drupal.org/node/1188622.

To use figures please apply the current patch in the issue above and then apply this version.

mgifford’s picture

Issue tags: +Accessibility

I'm in favour of this.
http://html5doctor.com/the-figure-figcaption-elements/

What needs to happen to mark this RTBC with this module?

Needs backward compatibility for IE?

themusician’s picture

There hasn't been a release for this module in over two years. I still use on projects as it generally works well. I am not sure if the maintainers monitor this queue anymore. As far as IE compatibility, that would likely be a good piece to add in. Personally, I use variants of HTML shiv to provide the backwards compatibility.

To test the patch, please apply the patch in this issue, http://drupal.org/node/1188622 first and then the patch that is found here.

mgifford’s picture

I just updated #2098561: Stable release of Image Caption. Thanks @theMusician for the tip about the other patch.

davidwhthomas’s picture

Worth noting, though busy with other projects. I do monitor the issue queue here.

This plugin hasn't been updated for a while as it's had no significant bugs and has been in a stable working state.

Regarding the figcaption patch, it's nice if you want to use that method, however we would need an alternative mode for people using browsers that don't support figcaption ( e.g IE 7 & 8 )

regards,
David

themusician’s picture

The alternative method being baked into the module does certainly present a challenge.

It seems redundant to include a polyfill solution just for the case of figures and figcaptions. I am curious how many themes ship without a polyfill solution or whether hand coded themes are built without a solution in place.

Thanks for the feedback.

jpamental’s picture

Issue summary: View changes

It would be great to build a switch into the module so you could use either the current (older) method or the one proposed here (which ironically is the same update that I made on my own several years ago). I don't quite have the chops for it but will see if I can work it out. Seems like it could be an added preference that would call one version of the JS or the other.

jpamental’s picture

StatusFileSize
new6.25 KB

I'm attaching a slightly modified patch. I saw that @theMusician's patch in #7 was almost exactly what I had done, except I needed to get the image wrapped in the figure tag no matter what, and the module by default will only rewrap the image if there actually is a caption. This patch removes the conditional check and will always wrap an image in a figure tag even if there is no caption. I realize this is not for everyone but felt it was a common enough that it was worth posting for others to find.

jpamental’s picture

StatusFileSize
new6.19 KB

This is a slight update to the patch that eliminates any inline styles from being added to the 'figure' element. Again - maybe not for everyone, but it's getting me nice clean markup and then the added style gives me just what I need for theming.

mgifford’s picture

Status: Needs review » Needs work

Patch doesn't apply to the beta3 release.

mgifford’s picture

Status: Needs work » Needs review

Just saw how out of date the release is. It still does apply to the dev version.