Skip to content

[4.1] Remove readonly on media fields#36945

Closed
brianteeman wants to merge 1 commit intojoomla:4.1-devfrom
brianteeman:patch-6
Closed

[4.1] Remove readonly on media fields#36945
brianteeman wants to merge 1 commit intojoomla:4.1-devfrom
brianteeman:patch-6

Conversation

@brianteeman
Copy link
Contributor

PR for #28852

The field was readonly for the reasons states by @dgrammatiko and I respect those views. But the request for the ability to paste an image url directly into the field by @coolcat-creations and others also makes sense.

As you can see its a super simple PR to achieve this. All the features of the media field are maintained and you can paste an image url directly. However when pasting a url you do not get the data attributes and lazy loading. I believe this to be an acceptable solution.

To test try to use the full article image or a custom media field and make sure you can still select an image and that you can now paste an image url

PR for joomla#28852 

The field was readonly for the reasons states by @dgrammatiko and I respect those views. But the request for the ability to paste an image url directly into the field by @coolcat-creations and others also makes sense.

As you can see its a super simple PR to achieve this. All the features of the media field are maintained and you can paste an image url directly. However when pasting a url you do not get the data attributes and lazy loading. I believe this to be an acceptable solution.
@coolcat-creations
Copy link
Contributor

Hi @brianteeman thank you so much for creating the PR!

I thought the right solution would be to "validate the URL, get the image adapter, get the image dimensions" I see it coming that people complain that lazy load does not work.

So how can we make a good solution to 1) make the paths "pasteable" 2) have it working like intended by media manager team ?

Or would this be the first step, and maybe in 4.2 we can create a pseudocron which checks the image paths and adds this markup ?

@brianteeman
Copy link
Contributor Author

I thought the right solution would be to "validate the URL, get the image adapter, get the image dimensions" I see it coming that people complain that lazy load does not work.

That's kind of what Dimitiris was telling you. If you want to paste the image then you cant have the other parts when you do

@coolcat-creations
Copy link
Contributor

Yes, maybe I misunderstood him, I thought it was possible to do these checks for pasted paths but that he does not want to do it so he suggested a bad solution over the right solution. Did I misunderstood?

@dgrammatiko
Copy link
Contributor

Fwiw the code for getting the size of the image already exists since #34177 so what is missing is a way to:

  • validate that what the user inserted is a valid url
  • Extract the media adapter if there is one

just Because it’s easy to remove an attribute it doesn’t mean that the result will be automatically acceptable. For me it’s not, the media field goes from a field that always produces valid urls to accepting any kind of strings…

@coolcat-creations
Copy link
Contributor

Why isn't it possible to let the user put in the path and have a button which says "validate and save" or something?

@dgrammatiko
Copy link
Contributor

Why isn't it possible to let the user put in the path and have a button which says "validate and save" or something?

That's not how form fields validation works in HTML. You have an event onInput that you can listen for inserted text and act upon it, there's no need for button or any other fancy UI...

@coolcat-creations
Copy link
Contributor

So what is the right approach ? Where do we need to change what line?

@Razzo1987
Copy link
Contributor

@brianteeman the preview dosn't work with image generated like https://via.placeholder.com/350x150

@Razzo1987
Copy link
Contributor

Hi @dgrammatiko ,
I perfectly understand your safety point.
In the PR #31398 (which is not very different from @brianteeman 's) we had already discussed that it was necessary to reintroduce the functionality of being able to put custom URLs after their validation, but that at the moment NO ONE was working on it.

Today, the situation does not seem to have changed. Here (#28852 (comment)) you were also talking about integration with third-party sources. Another beautiful idea that I don't see it in the roeadmap for Joomla! 4.1 or 4.2.

Personally I think that for now the best way is to allow users to enter the custom URL as they did in Joomla 3, when we have a media manager who does the necessary checks and inserts images from Dropbox, AWS, S3, custom, etc we can again put back the read-only attribute.

@dgrammatiko
Copy link
Contributor

I already stated what needs to be done here #36945 (comment) but then again I'm not a gatekeeper or some kind of authority here, so if allowing any string in this field value is acceptable then this PR is fine

@coolcat-creations
Copy link
Contributor

Yes thanks but for me you could have write it in Japanese and i would not know what to do now :-) Maybe someone knows. I hope.

@richard67 richard67 added the PBF Pizza, Bugs and Fun label Apr 22, 2022
@RickR2H
Copy link
Member

RickR2H commented Apr 22, 2022

I have tested this item ✅ successfully on 233ad78

Patch works! Maybe it is a good idea to check if the image link is valid. Can be added in a new PR though.


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

@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item 🔴 unsuccessfully on 233ad78


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

@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item ✅ successfully on 233ad78


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

@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item 🔴 unsuccessfully on 233ad78


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

@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item ✅ successfully on 233ad78


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

2 similar comments
@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item ✅ successfully on 233ad78


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

@kiki-G
Copy link

kiki-G commented Apr 22, 2022

I have tested this item ✅ successfully on 233ad78


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

@joomla-cms-bot joomla-cms-bot removed PBF Pizza, Bugs and Fun PR-4.1-dev labels Apr 22, 2022
@RickR2H
Copy link
Member

RickR2H commented Apr 22, 2022

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 22, 2022
@RickR2H RickR2H added PBF Pizza, Bugs and Fun PR-4.1-dev labels Apr 22, 2022
@dgrammatiko
Copy link
Contributor

dgrammatiko commented Apr 22, 2022

@RickR2H @brianteeman I object here. What this PR is doing is WRONG! ignoring that there's no validation and you can end up with FOOBAR values and 404 in your pages and the fact that this essentially bypasses the lazy loading feature there's something even more hurtful: the images will NOT have width and height attributes meaning that these images will contribute negatively in the Layout shifting metrics and thus hurting SEO!. Just let the people that want this functionality to create a layout override and themselves remove the readonly attribute OR find someone to write the few lines of JS needed so this could not have any MAJOR impact in performance and SEO.

Web Archive 2022 is in the way and afaik Joomla is not helping itself if keeps the last position in the ranking.

My 2c and unsubscribing

@coolcat-creations
Copy link
Contributor

It would be really good to have the possibility to paste the path AND have width height - User Experience for selecting images is zero right now.

@richard67
Copy link
Member

Setting the RLDQ (release leads decision queue) label to get a decision.

@dgrammatiko
Copy link
Contributor

User Experience for selecting images is zero right now.

You're not improving things by just making them worst, do you? I, keep repeating that this COULD be done reasonably with some JS but not just removing the readonly attribute simply because the results are not the same. Either fix it properly or keep the bad UX (according to you) which at least was done to improve SEO and perf...

@richard67 richard67 added the RMDQ ReleaseManagerDecisionQueue label Apr 22, 2022
@roland-d
Copy link
Contributor

As for "security" anybody with some wit can remove the readonly attribute using DevTools from their browser. Validation should always happen server side.

@coolcat-creations
Copy link
Contributor

User Experience for selecting images is zero right now.

You're not improving things by just making them worst, do you? I, keep repeating that this COULD be done reasonably with some JS but not just removing the readonly attribute simply because the results are not the same. Either fix it properly or keep the bad UX (according to you) which at least was done to improve SEO and perf...

If it's so easy to improve it why won't you help? I can't because I don't know how.

@brianteeman
Copy link
Contributor Author

If it's so easy to improve it why won't you help? I can't because I don't know how.

i tried

@coolcat-creations
Copy link
Contributor

@dgrammatiko how much would it cost to fix it in a proper way?

@dgrammatiko
Copy link
Contributor

Please close this and test #37654

@brianteeman
Copy link
Contributor Author

Happy to

@brianteeman brianteeman deleted the patch-6 branch April 25, 2022 16:13
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 25, 2022
@richard67 richard67 removed the PBF Pizza, Bugs and Fun label Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RMDQ ReleaseManagerDecisionQueue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants