? NPM Resource Changed ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
18 Nov 2020

Pull Request for Issue #31319 .

Summary of Changes

Should solve the release blocker #31319

  • It restores the ability to create a Figure element around the image. This happens only if you provide some figure caption text

  • It restores the ability to insert custom classes to an image (space separated)

  • It also introduces the No Description checkbox that @brianteeman introduced in other places (so basically now it's also available for the images inserted into an editor)

But also

  • It doesn't bring the Position field to Joomla 4. The reason is that this has already been converted in the other places to use classes, ref: #31017
  • It doesn't bing also title to the available image tags. The reason is that title adds nothing to a11y, but don't take my word for this, read about title in MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img (search for title attribute)

Screenshot 2020-11-18 at 16 13 09
Screenshot 2020-11-18 at 16 10 17
Screenshot 2020-11-18 at 16 12 45

Styling

Before going nuclear on this, let me just say that I introduced the functional part of the code. I just styled (adding a position and a background) so it can be tested. Feel free to style it as you like, the css lives @ build/media_source/system/css/fields/joomla-image-select.css. Also please don't ask me to style it, I'm not a fan of bootstrap

Testing Instructions

This PR needs rebuilding of the assets so either npm I or download the package for the PR!!!

Edit an article.
In the editor insert an image using the xtd-button.
Try all the combos and check the inserted text (just toggle the editor)

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

No (?)

avatar dgrammatiko dgrammatiko - open - 18 Nov 2020
avatar dgrammatiko dgrammatiko - change - 18 Nov 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Nov 2020
Category Administration Language & Strings Repository NPM Change JavaScript Front End Plugins
avatar dgrammatiko dgrammatiko - change - 18 Nov 2020
Labels Added: ? NPM Resource Changed ?
avatar brianteeman
brianteeman - comment - 18 Nov 2020

It also introduces the No Description checkbox that @brianteeman introduced in other places (so basically now it's also available for the images inserted into an editor)

Thanks for doing this.

I am not in favour of the ALT Description and checkbox being hidden behind an obscure button. To satisfy the BC release blocker it must not be hidden and must be located near to the insert image button

Please label the two fields the same as the ones I have created for everything else for consistency

image

cc @carcam

avatar dgrammatiko
dgrammatiko - comment - 18 Nov 2020

To satisfy the BC release blocker it must not be hidden and must be located near to the insert image button

Realistically speaking I don't see this happening but let me explain the reason (there are tight constrains here). The container that holds all the fields for the extra data is appended on the fly (it's not part of the media manager, it's a own small app, if you like with a sole purpose to make available the data inserted in those fields from the user). The problem comes that both this container and the media manager (which unfortunately is an iframe) share the same space. If you want to have this always visible you'll end up with two possible scenarios:

  • Always pushing the content of the media manager down
  • have the additional fields below the media manager

Both are way worse than the detail element.

Edit That said I can open the details on the select event, so it would be the same, from ux point of view

Done the additional data panel will open automatically whenever an image is selected

avatar brianteeman
brianteeman - comment - 18 Nov 2020

Thanks - will try to find some time tomorrow to test

avatar ceford ceford - test_item - 19 Nov 2020 - Tested successfully
avatar ceford
ceford - comment - 19 Nov 2020

I have tested this item successfully on dd4e239

I like it! It works as advertised. I have some afterthoughts that I will post separately (I need a record because I will revise associated Help screens when this is merged).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31425.

avatar ceford
ceford - comment - 19 Nov 2020

Could the Additional Data drop-down be given a border and some padding? It appears in the open state and is not so obviously a drop-down.

If you enter some Additional Data and click the image again the data is lost.

If you insert an image with Additional Data and later select the image to edit the Additional Data is blank. If left blank and saved the figure data is preserved but the image data is replaced - so the img class is lost.

If two images are inserted the second figure block is inserted inside the first figure block:

<figure class="fclass1 float-left mr-3"><img class="iclass1" src="images/sampledata/parks/landscape/120px_rainforest_bluemountainsnsw.jpg" width="120" height="99" loading="lazy" /> 
<figure class="fc2 float-right"><img class="imc1" src="images/sampledata/parks/landscape/180px_ormiston_pound.jpg" alt="Another" width="120" height="90" loading="lazy" />
<figcaption>Another</figcaption>
</figure>
<figcaption>Pretty Place</figcaption>
</figure>

Is that a bug? Or is there a workaround?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31425.

avatar brianteeman
brianteeman - comment - 19 Nov 2020

They're bugs. You shouldnt have to have a workaround. Please adjust your test results.

avatar dgrammatiko
dgrammatiko - comment - 19 Nov 2020

If you enter some Additional Data and click the image again the data is lost.

Expected behaviour. The Media manager is different app that communicates with the selector only by events. Re-selecting the same image triggers the event and the image selector resets everything.

If you insert an image with Additional Data and later select the image to edit the Additional Data is blank. If left blank and saved the figure data is preserved but the image data is replaced - so the img class is lost

I think your expectations are wrong here. The workflow for the image XTD button is only for inserting a new image. If you want to edit the inserted image you need to select the image in the tinymce toolbar (I mean the tinyMCE native, own button)

If two images are inserted the second figure block is inserted inside the first figure block:

That is also a problem with all the nested elements. You can do that either with native tinyMCE buttons or the Joomla XTD. Not a limitation or bug. Just make sure that your cursor is in the correct place (eg outside to the previous image)...

Could the Additional Data drop-down be given a border and some padding? It appears in the open state and is not so obviously a drop-down.

As I wrote in the description, this is essentially unstyled. You're welcome to style it as you like either with a PR to this branch or with a another PR once this is merged (if ever)

Thanks for testing

Edit: #31427 might solve the reselection problem If you enter some Additional Data and click the image again the data is lost. (tbh I haven't tried the combo but iirc the other PR will only spit one event per image, thus solving the problem)

avatar ceford ceford - test_item - 19 Nov 2020 - Not tested
avatar ceford
ceford - comment - 19 Nov 2020

I have not tested this item.

Having thought about this some more I am not sure I like it so much. When inserting a second image I did put a space after the first image and before selecting the insert tool - that produced the code I quoted, which is invalid. It seems to me it would be better to have a completely separate way to insert a picture template and let the media manager deal with the img tag alone.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31425.

avatar dgrammatiko
dgrammatiko - comment - 19 Nov 2020

Having thought about this some more I am not sure I like it so much. When inserting a second image I did put a space after the first image and before selecting the insert tool - that produced the code I quoted, which is invalid. It seems to me it would be better to have a completely separate way to insert a picture template and let the media manager deal with the img tag alone.

Please test the same features on J3. Then retry the J4. I'm not reinventing the wheel here...

avatar brianteeman
brianteeman - comment - 19 Nov 2020

Just make sure that your cursor is in the correct place (eg outside to the previous image)...

impossible on an article with no existing content - try it and you will see

avatar brianteeman
brianteeman - comment - 19 Nov 2020

@carcam please have the accessibility team test this

avatar brianteeman
brianteeman - comment - 19 Nov 2020

Please test the same features on J3. Then retry the J4. I'm not reinventing the wheel here...

Confirming the bug is present there as well. So it should be its own issue report and doesnt prevent this being merged

I have tested the alt text stuff and it works as expected - thanks for updating the text as well.

As far as I am concerned it does resolve the release blocker.

Not a huge fan of the way the alt text etc is displayed but as it opens by default it does satisfy my wish for the alt text stuff to be "in your face" - as you said the design etc maybe can be improved but that doesnt prevent this being merged

I am not commenting on the usability of this with a screen reader as to be honest the entire media manager is pretty tricky to use anyway

avatar dgrammatiko
dgrammatiko - comment - 19 Nov 2020

Confirming the bug is present there as well. So it should be its own issue report and doesnt prevent this being merged

I've just fixed it here by altering something in tinyMCE's config and adding couple contenteditable="" tags. Not sure if this could be back ported in J3, iirc the versions are different so it might not work...

avatar ceford
ceford - comment - 19 Nov 2020

I added an image to an article in J3 - no figure data of course. Saved image, saved article. Select image to edit - the edit form (media manager) opens with all of the previously entered data all present and correct.

In J4 when I select an image to edit the media manager opens without the image selected. If I select the same image then I have to enter all of the metadata again. So I have to remember to to use Insert/Image instead of CMS Content/Image.

I am suggesting we have an Insert/Figure option. And somehow fix the media manager to show the selected image for editing, as in J3. Is that possible?

Added later: just realised I was using JCE rather than TinyMCE for J3. The former does keep img data for editing and the latter does not.

avatar dgrammatiko
dgrammatiko - comment - 19 Nov 2020

I am suggesting we have an Insert/Figure option. And somehow fix the media manager to show the selected image for editing, as in J3. Is that possible?

@ceford you need to step back a bit and realise what all these CMS Content are doing: they are just inserting data to the editor (tinyMCE, Codemirror, none, or any 3RD party). They're there to just hand in some data (links, img tags, etc) to the editor. Editing the inserted content is down to each editor's capabilities. The button are stateless so it's kinda impossible to, let's say select a menu and then reclicking the button to edit the menu as the buttons don't have this information (stateless)...
Basically what you're asking is something I tried to implement many years ago #7170 but it was rejected as it would have made 2 different experiences (core will be different than any 3rd part extension)

avatar ceford
ceford - comment - 19 Nov 2020

@dgrammatiko thanks for the comments. I think I see what you mean. I have had a look at the TinyMCE documentation on their web site and looked through some of the code. It is a little beyond my experience.

At the moment the data entry form is showing JFIELD_MEDIA_CLASS_LABEL and
JFIELD_MEDIA_FIGURE_CLASS_LABEL.

avatar dgrammatiko
dgrammatiko - comment - 19 Nov 2020

@ceford should be ok now

avatar ceford ceford - test_item - 20 Nov 2020 - Tested successfully
avatar ceford
ceford - comment - 20 Nov 2020

I have tested this item successfully on 84264a4

If you create an image with Figure data, then replace the image but don't fill in the Figure data, then the previous Figure data is preserved. I like that. And I can change the figure class using the code view or the toggle editor view. So that is an easy way of experimenting with layouts. Good to go!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31425.

avatar adj9
adj9 - comment - 21 Nov 2020

I would like to test the PR by installing it, but I cannot download the complete package.

If you do a test then I will try.

avatar dgrammatiko
dgrammatiko - comment - 21 Nov 2020

@richard67 @Quy can someone restart drone here?

avatar richard67
richard67 - comment - 21 Nov 2020

@dgrammatiko It seems drone has hung up so nobody can access the page to restart it. You can trigger a new run by pushing some changes to your branch, e.g. by updating it to latest 4.0-dev.

avatar richard67
richard67 - comment - 21 Nov 2020

Hmm, Drone still doesn't start. I have no idea why. Maybe we just need to be patient, at least I hope so.

avatar dgrammatiko
dgrammatiko - comment - 24 Nov 2020

@richard67 is it normal that drone doesn't even appear here? @zero-24 any clues?

avatar richard67
richard67 - comment - 24 Nov 2020

@dgrammatiko No, it's not normal, and I don't have a clue.

avatar dgrammatiko dgrammatiko - change - 25 Nov 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-11-25 00:22:52
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - close - 25 Nov 2020
avatar dgrammatiko dgrammatiko - change - 25 Nov 2020
Status Closed New
Closed_Date 2020-11-25 00:22:52
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - change - 25 Nov 2020
Status New Pending
avatar dgrammatiko dgrammatiko - reopen - 25 Nov 2020
avatar HLeithner HLeithner - change - 25 Nov 2020
The description was changed
avatar HLeithner HLeithner - edited - 25 Nov 2020
avatar dgrammatiko
dgrammatiko - comment - 25 Nov 2020

@HLeithner thanks for fixing Drone. Btw can someone add the Release Blocker tag here?

avatar richard67
richard67 - comment - 25 Nov 2020

Added "Release Blocker" as inherited from the issue.

avatar dgrammatiko dgrammatiko - change - 5 Dec 2020
Labels Added: ?
avatar wilsonge wilsonge - change - 18 Dec 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-12-18 03:27:45
Closed_By wilsonge
avatar wilsonge wilsonge - close - 18 Dec 2020
avatar wilsonge wilsonge - merge - 18 Dec 2020
avatar wilsonge
wilsonge - comment - 18 Dec 2020

Thanks!

Add a Comment

Login with GitHub to post a comment