Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Fixed Toolbar: removing popup removes ui-page-header-fixed class #7252

Conversation

cgack
Copy link
Contributor

@cgack cgack commented Mar 17, 2014

Fixes #6987
Fixes #6939

@@ -278,11 +278,18 @@ define( [ "jquery", "../widget", "../core", "../animationComplete", "../navigati

_destroy: function() {
var $el = this.element,
header = $el.hasClass( "ui-header" );
header = $el.hasClass( "ui-header" ),
hasFixedChildren = $el.closest( ".ui-page" ).children( ".ui-header-fixed" ).length > 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line length

@arschmitz
Copy link
Contributor

Throughout both js files lots of hungarian notation used the style guide does not allow for hungarian notation.

@cgack
Copy link
Contributor Author

cgack commented May 29, 2014

@arschmitz I updated the pr with another commit. feel free to review whenever.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.33%) when pulling 41ad1ab on cgack:6987-destroyed-popup-removes-page-header-fixed into 923c1f8 on jquery:master.

@cgack
Copy link
Contributor Author

cgack commented Jun 2, 2014

@arschmitz I have updated this pr. I had left the $el alone originally because it had previously existed, but I see the value in removing those when we are in there to clean it up. There are others in that file - should I make an issue to clean up the hungarian notation and get that fixed as well? Also, I switched away from using $.mobile.pageContainer as well.

@arschmitz
Copy link
Contributor

Yes I only mentioned it here because its one your actually using. I think a new issue to clean this file up is the right way to go for the rest.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.56%) when pulling 50e7c8b on cgack:6987-destroyed-popup-removes-page-header-fixed into 923c1f8 on jquery:master.

@arschmitz
Copy link
Contributor

@cgack it looks like you don't have your full name ( only have cgack ) in your git config can you update this please.

@arschmitz
Copy link
Contributor

Iv just realized there is a much bigger issue here, that any time you destroy any toolbar its treating it as a fixed toolbar. Popup's toolbar is not fixed and so the logic from the fixedtoolbar extension should not even be running in the first place. Also we are never calling _super() here to allow toolbar destroy to run. Everything in destroy should be in an if statement to make sure position:fixed and we should always be calling _super() and make sure there is no unnecessarily duplicated logic between toolbar destroy and fixedToolbar.

@cgack
Copy link
Contributor Author

cgack commented Jun 6, 2014

@arschmitz I've updated my git config on that machine so it'll be ready for the next push.
it seems that toolbar by itself has no destroy method, unless I'm missing it. Should this be a new issue to add that functionality and then allow for _super() here

@arschmitz
Copy link
Contributor

@cgack ahh good point ok so destroy here is a mess lol.

This is all really the same issue though that toolbars _destroy ( what should be actually getting called here ) is missing.

So I think we need to just update the issue and fix the real problem here.

@cgack
Copy link
Contributor Author

cgack commented Jun 6, 2014

Okay - i'll work on getting _destroy added to toolbar and add it to this PR then

@arschmitz
Copy link
Contributor

@cgack Thanks sorry to initially lead you down the wrong path!

@cgack
Copy link
Contributor Author

cgack commented Jun 6, 2014

@arschmitz Thinking maybe we should push this to milestone 1.4.4 so that adding _destroy doesn't hold up 1.4.3

@arschmitz
Copy link
Contributor

@cgack you are probably right unless you get to it in next few days

@cgack
Copy link
Contributor Author

cgack commented Jun 6, 2014

@arschmitz I went ahead and gave it a go at adding _destroy to toolbar.js. There seems to be a bunch of stuff going on in there and I think I hit it all but a review is most definitely in order here. I wasn't sure what we did about removing aria roles or things like that in _destroy methods, also not sure how to handle if the footer has been appended to body if we could ever know where to put it back.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.81%) when pulling 95579f0 on cgack:6987-destroyed-popup-removes-page-header-fixed into 923c1f8 on jquery:master.

@gabrielschulhof
Copy link

@cgack without having read any of the thread except the part about where to put it back, I can tell you that, in popup, where I also move this.element from one place to another, I put a hidden div into the location from which I remove this.element, so that during _destroy() I'll have a place to put it back - i.e., placeholder.before( this.element ).remove().

@jaspermdegroot
Copy link
Contributor

This PR is meant to fix issues that have a 1.4.x milestone. That brings up the discussion again if adding a missing method can be considered as a bug fix and land in a maintenance release or a new feature which should wait until next version. IINM the outcome of previous discussions was that adding methods always has to wait until next version.

I suggest we open a new ticket for Toolbar widget review (already on our roadmap for 1.5) and re-milestone #6987 and #6939 to 1.5.

@arschmitz
Copy link
Contributor

@uGoMobi its always been there just not correctly implemented

@jaspermdegroot
Copy link
Contributor

Ok, found the _destroy() in the fixedToolbar extension. So we won't be adding a new method. Then we can fix it for 1.4.3 or 1.4.4.

.removeAttr( "aria-level" );

if ( this.role === "header" ) {
this.element.children( "a, button" ).removeClass( "ui-btn-left ui-btn-right" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at least for 1.4.4 we need to remove all the button classes since the button is enhanced as part of the enhancement process on the toolbar it should be destroyed as well.

@cgack
Copy link
Contributor Author

cgack commented Aug 28, 2014

@arschmitz went the the PR and made the requested changes. Thanks for the review!

hasFixedChildren = $.mobile.document.find( ".ui-header-fixed" )
.length > 0;
toolbarClasses = "ui-header-fixed ui-footer-fixed ui-header-fullscreen in out";
toolbarClasses += " ui-footer-fullscreen fade slidedown slideup ui-fixed-hidden";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then doing += do

toolbarClasses =  "ui-header-fixed ui-footer-fixed ui-header-fullscreen in out" +
    " ui-footer-fullscreen fade slidedown slideup ui-fixed-hidden";

@cgack
Copy link
Contributor Author

cgack commented Aug 29, 2014

@arschmitz I made some more adjustments per your PR comments. Thanks for reviewing!

if ( this.options.position === "fixed" ) {
hasFixed = $( "body>.ui-" + this.role + "-fixed" )
.add( page )
.find( ".ui-" + this.options.role + "-fixed" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok while this works and i suggested it i think i typed it with a parentheses in the wrong place :/
should be

$(  "body>.ui-" + this.role + "-fixed" ).add( page.find( ".ui-" + this.options.role + "-fixed" ) ).not( this.element ).length > 0;

same for fullscreen checkbelow

@cgack
Copy link
Contributor Author

cgack commented Sep 4, 2014

@arschmitz I have modified the PR. Thanks for the review!

@arschmitz
Copy link
Contributor

@cgack looks good 👍 will land shortly

@cgack cgack force-pushed the 6987-destroyed-popup-removes-page-header-fixed branch from 0c46cc9 to 2aaac08 Compare September 4, 2014 18:45
@cgack cgack force-pushed the 6987-destroyed-popup-removes-page-header-fixed branch from 2aaac08 to 1cc1611 Compare September 4, 2014 19:01
@cgack
Copy link
Contributor Author

cgack commented Sep 4, 2014

@arschmitz rebased with master and updated - hopefully the line endings are good now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants