? Success

User tests: Successful: Unsuccessful:

avatar Sophist-UK
Sophist-UK
27 Sep 2014

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.

image

The fix is to change the <a> tag for a <button> tag in /libraries/cms/form/field/contenthistory.php at lines 49/53.

avatar Sophist-UK Sophist-UK - open - 27 Sep 2014
avatar jissues-bot jissues-bot - change - 27 Sep 2014
Labels Added: ?
avatar zero-24 zero-24 - change - 27 Sep 2014
The description was changed
avatar zero-24 zero-24 - change - 27 Sep 2014
Category Front End UI/UX
avatar zero-24 zero-24 - test_item - 27 Sep 2014 - Tested unsuccessfully
avatar zero-24
zero-24 - comment - 27 Sep 2014

@Sophist-UK hmm it looks strange but I need to mark a unsuccessfull test.

First i can't reproduce the issue with core protostar:
screen shot 2014-09-27 at 12 48 11

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/.

avatar Sophist-UK
Sophist-UK - comment - 28 Sep 2014
  1. Yes - I find the same. I will look into whether this can be solved.

  2. I have identified the cause and it is fixable - but I need a little further research to ensure that there are not unintended consequences.

avatar Sophist-UK Sophist-UK - change - 28 Sep 2014
The description was changed
avatar Sophist-UK
Sophist-UK - comment - 28 Sep 2014

Fixed.

avatar zero-24 zero-24 - test_item - 28 Sep 2014 - Not tested
avatar zero-24 zero-24 - test_item - 28 Sep 2014 - Tested successfully
avatar zero-24
zero-24 - comment - 28 Sep 2014

thanks works now @Sophist-UK

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar dgt41
dgt41 - comment - 28 Sep 2014

@Sophist-UK Is rel attribute compatible with button? I mean the page still validates? http://validator.w3.org

avatar Sophist-UK
Sophist-UK - comment - 28 Sep 2014

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/.

avatar zero-24
zero-24 - comment - 28 Sep 2014

http://validator.w3.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&amp;layout=modal&amp;tmpl=component&amp;field=jform_contenthistory&amp;item_id=24&amp;type_id=1&amp;type_alias=com_content.article&amp;af11649d0dbe297f0abda46cc522df9b=1" rel="{handler: 'iframe', size: {x: 800, y: 500}}">
avatar zero-24
zero-24 - comment - 28 Sep 2014

But it works for me on

  • Firefox 32.0.3
  • Opera 24.0.1558.64
  • Chrome 37.0.2062.124 m
  • IE 11 (11.0.960.17278; Updateversion: 11.0.12)
avatar Sophist-UK
Sophist-UK - comment - 28 Sep 2014

Yes - I got the same validator error messages. But overall I still think it is OK.

avatar dgt41
dgt41 - comment - 28 Sep 2014

@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...

avatar Sophist-UK
Sophist-UK - comment - 28 Sep 2014

@dgt41 - No offence taken I assure you. And providing the reference to your PR is a useful link.

avatar dgt41
dgt41 - comment - 28 Sep 2014

@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...

avatar roland-d
roland-d - comment - 2 Oct 2014

@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.

avatar Sophist-UK
Sophist-UK - comment - 2 Oct 2014

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.

avatar roland-d
roland-d - comment - 2 Oct 2014

@Sophist-UK Thanks for the explanation, all clear to me now. Going to test ;)

avatar roland-d roland-d - test_item - 2 Oct 2014 - Tested successfully
avatar zero-24
zero-24 - comment - 2 Oct 2014

@roland-d As noted above i can't reproduce this #4369 (comment)

avatar roland-d
roland-d - comment - 2 Oct 2014

@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.

avatar roland-d roland-d - change - 2 Oct 2014
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 3 Oct 2014

@test
No change here for display in Protostar

avatar Sophist-UK
Sophist-UK - comment - 3 Oct 2014

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.

avatar roland-d
roland-d - comment - 3 Oct 2014

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.

avatar phproberto phproberto - change - 8 Oct 2014
Labels Added: ?
avatar phproberto phproberto - close - 8 Oct 2014
avatar phproberto phproberto - change - 8 Oct 2014
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2014-10-08 06:55:07
avatar dgt41
dgt41 - comment - 12 Oct 2014

@Sophist-UK please check if #4561 works for you

avatar Sophist-UK
Sophist-UK - comment - 12 Oct 2014

@dgt41 Sorry - but I am tied up with other stuff at present and won't be able to do this for you.

Add a Comment

Login with GitHub to post a comment