Sometimes the tabs randomly change position, not paying attention to the order allocated by the form.

CommentFileSizeAuthor
#3 tabweightissue.png3.69 KBmatt.nz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo’s picture

Hmm, possibly a bug introduced by the recent conversion in how we process tabs. Previously we explicitly assigned weights. I stripped out that code because it didn't seem to be needed any more, but possibly I was wrong....

Meantime you could explicitly assign #weight properties to your tabpage elements, but we should identify and fix this issue.

matt.nz’s picture

Ah, thanks, that works perfectly! I have a loop to generate the items and just added:
'#weight' => $tabcount++,
and it does exactly what it needs to.

Looks like the weights might be a necessity!

matt.nz’s picture

FileSize
3.69 KB

Hmm, apparently editing the weights doesn't completely fix the order the tabs want to take. Now the 'last' class is assigned to something that's not the last tab. For me, the second to last tab takes the class "last". Screenshot of tabs structure attached.

dww’s picture

FWIW, I'm seeing the same problem on a site I'm working on now using 6.x-1.2 of tabs. Manually setting the weight does the trick for me, too...

nedjo’s picture

I haven't reproduced this issue. Could someone post the code that produces broken tabs?

I committed a fix to the error with first and last classes (moved to js rather than PHP, which ran before sorting by weight).

GiorgosK’s picture

if no "#weight" is given then the order declaration is not kept

try using at least 4 tabs that should reveal the problem

GiorgosK’s picture

Version: 6.x-1.2 » 6.x-1.3

using tabs 1.3

matt.nz’s picture

It seems this is as simple to fix as re-adding the code that added the weights??

greg.harvey’s picture

Priority: Normal » Major

This has just begun to happen for me after an update. No idea why. It worked fine on local dev server, but broke on live after update. Tab order is all over the place. Increasing the priority, since if the tabs module can't consistently order tabs created via the hook something is quite wrong! Testing now.

greg.harvey’s picture

Adding weight seems to fix this - but something is wrong. Normally when you output an array without specifying weight the order is the order of the array. What I'm seeing is sometimes this is the case, but some other times (and it seems arbitrary) the array order is ignored and some seemingly completely random order is applied instead. There also doesn't seem to be anything in particular that triggers this random behaviour.

In short, it seems manually applying weight is a workaround, but not a fix.