User tests: Successful: Unsuccessful:
Pull Request to remove the legacy caption.js
Removes the JHtml::_('behavior.caption') calls, the method itself and its JS files and test code.
figure
and figcaption
long ago. The JS was kept and loaded for B/C reasons with existing old articles.Captions work as before
Captions work as before
Mark the method as deprecated in 3.9 (I can do that PR) and in the docs.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_contact com_content com_newsfeeds Libraries JavaScript Unit Tests |
Captions should work as before because we actually moved to use figure and figcaption long ago. The JS was kept and loaded for B/C reasons with existing old articles.
New articles created in 3.8 do not use figure and figcaption. So what is the plan to convert all articles on upgrade
@brianteeman are you referring to intro/full image or the images in the full text field (editor)?
intro/full is the only one that has caption
So we can update their jLayouts to use figcaption/figure tags
This I think should be ok
<?php if (isset($images->image_fulltext) && !empty($images->image_fulltext)) : ?>
<?php $imgfloat = empty($images->float_fulltext) ? $params->get('float_fulltext') : $images->float_fulltext; ?>
<figure class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image">
<img src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>" itemprop="image"/>
<?php if ($images->image_fulltext_caption) :
echo '<figcaption class="caption">'
. htmlspecialchars($images->image_fulltext_caption)
. '</figcaption>';
endif; ?>
</figure>
<?php endif; ?>
@brianteeman Since J3.2.2 the image button in the editor should create figure and figcaption elements. My PR back then was #2664 and when I tested it now it still works this way.
Of course, articles created before that time would have "broken" captions as long as you don't load a replacement JS (eg using a plugin) or edit the articles to use figure. There is no way we can do that on updates.
I assumed we had changed the into/fullimages layouts as well, but apparently that was never done? Of course that then needs to be done in this PR as well. No need to update anything on the content for this.
Or do I miss something?
I assumed we had changed the into/fullimages layouts as well, but apparently that was never done? Of course that then needs to be done in this PR as well. No need to update anything on the content for this.
yes that is all that needs to be done
Labels |
Added:
?
?
|
Category | Front End com_contact com_content com_newsfeeds Libraries JavaScript Unit Tests | ⇒ | Front End com_contact com_content com_newsfeeds Layout Libraries JavaScript Unit Tests |
Adjusted the layouts for the intro and full image to use figure
and figcaption
tags.
The figure
is always added, regardless if there is a caption or not.
@brianteeman I've read that the figure
element should have an aria role=group
if there is a caption included. I've added that one. Maybe you can verify if that is correct.
@brianteeman I can't say I understand everything written there. My knowledge about accessibility is quite limited. I got the part about the role=group from a german site (https://wiki.selfhtml.org/wiki/HTML/Textstrukturierung/figure).
What I got from your article is that the caption should be before the image, and in fact with the caption.js currently it's like that as well. So I moved that around.
@brianteeman are the changes ok regarding accessibility?
@dgrammatiko can you fix the related js tests from the testing repo?
@Bakual can you fix the conflicts here that we can move to the next step?
better to ask the accessibility team than me
Category | Front End com_contact com_content com_newsfeeds Libraries JavaScript Unit Tests Layout | ⇒ | Front End com_contact com_content com_newsfeeds Layout Libraries JavaScript |
Rebased PR and fixed the conflict
Ok, I'll remove that part then. Makes code simpler
Labels |
Removed:
?
|
Opened a pr joomla/test-javascript#7 in the testing repo to remove the caption.js tests. Once this is merged, we can merge this one here too.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-18 11:02:51 |
Closed_By | ⇒ | laoneo | |
Labels |
Added:
?
|
BTW, I do not understand what is behind the idea that the caption should be before the image.
My test show that with this template it displays above the image, which is a nonsense.
@infograf768 it is more a matter of taste but figcaption can be used above or below (or both).
!Idea: let's have some options in the backend for the placement of the caption...
PS. I'm joking
We need to remove the related js test: https://github.com/joomla/test-javascript/tree/master/src/caption
I'll do a PR for that (but I still have to convert at least one basic script test there as an example, so give me some time for this...)