User tests: Successful: Unsuccessful:
Fix for issue #4637
If you have versioning on, then a front end editing page has the version button misaligned with the Save and Cancel buttons.
This is due to the Save and Cancel buttons being rendered with the <button>
tag whilst Version is rendered with the <a>
tag - and different CSS is applied.
The fix is to change the <a>
tag for a <button>
tag in /libraries/cms/form/field/contenthistory.php
at lines 49/53.
Labels |
Added:
?
|
Category | ⇒ | Front End UI/UX |
Yes - I find the same. I will look into whether this can be solved.
I have identified the cause and it is fixable - but I need a little further research to ensure that there are not unintended consequences.
Fixed.
thanks works now @Sophist-UK
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
@Sophist-UK Is rel attribute compatible with button? I mean the page still validates? http://validator.w3.org
Yes - that may be an issue as it is not (AFAIK) officially part of the HTML spec. I have tested this in IE11 and Chrome and it works fine, but of course that doesn't guarantee it will work on other browsers or older versions of these browsers.
That said, the way that we use the rel attribute on the existing tag is not according to the HTML spec anyway (which states that rel needs to be one of "alternate, author, bookmark, help, license, next, nofollow, noreferrer, prefetch, prev, search, tag" - whilst we use it to hold a JSON for the iframe). In fact the href attribute is also not part of the spec - other buttons (like Save and Cancel) use an OnClick js method (e.g. Onclick="Joomla.submitbutton('article.save')"
) to action the button click whilst Version uses a different means of setting the click event using jQuery code created by JHtml::_('behavior.modal', 'button.modal_' . $this->id);
).
So, AFAICT the neither the existing Version tag nor my proposed
alternative would validate correctly. But in practice, I think that most browsers will parse the href and rel attributes into the DOM ok, and the JS will set the same on-click event on an<a>
or <button>
object.
So, on the whole I think this should be OK.
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
@Sophist-UK the validator tell me a error with the href attribut.
Line 362, Column 351: Attribute href not allowed on element button at this point.
…d0dbe297f0abda46cc522df9b=1" rel="{handler: 'iframe', size: {x: 800, y: 500}}">
Attributes for element button:
Global attributes
autofocus
disabled
form
formaction
formenctype
formmethod
formnovalidate
formtarget
menu
name
type
value
This is line 362
<button class="btn modal_jform_contenthistory" title="Versions" href="/git/index.php/component/contenthistory/?view=history&layout=modal&tmpl=component&field=jform_contenthistory&item_id=24&type_id=1&type_alias=com_content.article&af11649d0dbe297f0abda46cc522df9b=1" rel="{handler: 'iframe', size: {x: 800, y: 500}}">
But it works for me on
Yes - I got the same validator error messages. But overall I still think it is OK.
@Sophist-UK I didn’t want to sound negative but I also tried a few weeks before to tackle the same in a different way (wrapping an a tag around a button) as you can see here #4244. Just saying...
@Sophist-UK What I had in my mind, but never found the time to code it, was exactly what you did here but instead of using the JHtml::_('behavior.modal', 'button.modal_' . $this->id);
copy the code from html.php and make the initialization of modal there so no href and rel attributes spilled inside the button...
@zero-24 & @Sophist-UK How do you reproduce the issue? Is the PR to fix the Versions button alignment or just to make it consistent using the tag?
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4369.
I get this issue with the Shape Vertex template, but essentially it happens whenever the css for <a>
and <button>
have different top margins. So to recreate, you just need to have custom css which changes the top margin for tags.
The only way to ensure consistency across all templates is to use the same tag for all buttons. I would not have a problem converting <button>
tags to <a>
tags, but this is a larger changes, and the version functionality is newer and so it seemed to me that we should change this rather than the other buttons.
@Sophist-UK Thanks for the explanation, all clear to me now. Going to test ;)
@roland-d As noted above i can't reproduce this #4369 (comment)
@test All good, tested it on Windows + FireFox and Chrome + IE and Mac + FF and Safari
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4369.
Status | Pending | ⇒ | Ready to Commit |
The good news about all the tests on templates where the buttons already align ok is that changing the code doesn't misalign it.
They key point is that if we use consistent tags across all the buttons (which this PR does), then the buttons will definitely be aligned in all templates.
Indeed, there is no change in Protostar and that is the test that it is correct. Having consistent tags is in my opinion the real value in this PR.
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-10-08 06:55:07 |
@Sophist-UK please check if #4561 works for you
@Sophist-UK hmm it looks strange but I need to mark a unsuccessfull test.
First i can't reproduce the issue with core protostar:
And after the patch we indroduce a new issue. If you click the button after the patch the modal don't open. It redirect me to
http://localhost/git/index.php/component/content/?a_id=24
on my local test envoirment.Can you have a look into it?
This comment was created with the J!Tracker Application at http://issues.joomla.org/.