PDA

View Full Version : hideTab/unhideTab issues in Firefox



Jamie Avins
5 Dec 2006, 8:56 AM
When I hide multiple tabs and then unhide them, firefox is aligning them vertically while IE works fine.

After doing some research, Firefox does not like "block" to be set for table elements. TR's are a particular issue I've seen mentioned (http://www.andyjarrett.co.uk/andy/blog/index.cfm/2006/5/18/Css-Js-and-tr), and I'm guessing TD's are also problematic the results are very ugly.

In TabPanel.js the offending function



setHidden : function(hidden){
this.hidden = hidden;
this.pnode.setStyle('display', hidden ? 'none' : 'block');
},


Looks like since we are dealing with table elements, you should either store the style before any of this is done or perhaps just change 'block' to ''. The blank seems to work fine for me as a workaround for now.

tryanDLS
5 Dec 2006, 1:57 PM
Are you using the latest code (RC3)? I'm using FF and I don't see this issue. Are you calling hide/unhide to do this or are you trying to manipulate the styles?

Jamie Avins
6 Dec 2006, 6:34 AM
Perhaps you aren't in strict mode, Firefox is going to enforce the proper table display property in strict mode...

After more research, it makes sense that this is happening. The mistake made is that table elements are not block elements. The CSS 2.1 specification explains why this is happening, you are forcing a table-cell display style into a block display style http://www.w3.org/TR/CSS21/visuren.html#display-prop. The correct style is "table-cell" but I'm not sure how that would work for backward compatibility. So storing the original style and using that might be more appropriate. Blanking out the style seems to work as well.

Yes, using RC3. I'm specifically calling the hideTab and unhideTab functions (which both call setHidden that I referenced). If you take a tab bar with multiple tabs, hide them all, and unhide them you will see this behavior. I have tested it with both 1.5 and 2.0 versions of firefox.

Animal
6 Dec 2006, 6:48 AM
Setting the display style to "" is the recommended way of restoring default display style. The source should be changed to do this. Bump this thread when Jack returns.

tryanDLS
6 Dec 2006, 7:58 AM
Yeah, it's not even an issue of strict vs quirks - broken either way. I've added to this to my list of bugs for Jack to look when he returns - hopefully he won't have to go thru a week's worth of posts :)

Jamie Avins
6 Dec 2006, 10:42 AM
Excellent.

Also, while I'm at it...

I need to have the ability to rearrange the tab order. Do you have any recommended way of doing this without tearing down the tabItems and re-inserting them? Shuffle the order of td's within the tr or something to that effect would be the desired result, but I'm not sure what the best way of going about that would be. I'd be happy to contribute whatever I come up with when I'm done.

tryanDLS
6 Dec 2006, 11:21 AM
It doesn't look like there's a built in way to do this. I suppose you could access the internal collection, rearrange it, and then rebuild the TabPanel. You could then do addTabItem instead of addTab to eliminate rebuilding the tab. Just guessing here - haven't tried this.

Maybe the add methods need to support an optional index so you could insert wherever you want.

jack.slocum
6 Dec 2006, 11:38 PM
I will fix the display issue as soon as I get back.