Tab Panel displays multiple panel contents at once when there are more than 2 tabs

When you create tab panel and add more than 2 tabs, it starts to showing all tabs at once except of 2nd tab. Once you click on some tab, it works correctly then, but after load of page, it always shows all tabs except 2nd.

Reproduction Instructions

  • Create tab panel
  • Add at least 3 query panel tabs
  • Reload page
  • Tab panel now displays content of tabs 1 and 3
  • After click on tab 1 it shows only content of tab 1

Phabricator/Arcanist Version
phabricator
cf6df55dbee3482e9400867e6ff4e4d76266fe33 (Sat, Nov 9) (branched from 72f82abe0723a866856fa871f24a5e40ad9642bc on origin)
arcanist
db1959900a644d9b28064ec479af3296331d2a4f (Mon, Nov 4) (branched from cc1ff38843c47ef1516b9bdc3fa2ae00b2e53a38 on origin)
phutil
1750586fdc50a6cd98adba4aa2f5a7649bd91dbe (Sep 30 2019) (branched from 39ed96cd818aae761ec92613a9ba0800824d0ab0 on origin)
libcore
8013aa4c280ffed706e5ec35c0dab3b069162db2 (Tue, Oct 29)
services
2d7586076ae4bc622f423814c0a85f54b1a1589c (Sep 9 2019) (branched from c4bd119b358e783c1143128f44b7c020bf6ca080 on origin)
php
5.5.9-1ubuntu4.29
diff
3.3 at /usr/bin/diff
git
2.24.0 at /usr/bin/git
hg
2.8.2 at /usr/bin/hg
pygmentize
2.4.2 at /usr/local/bin/pygmentize
svn
1.8.8 at /usr/bin/svn

Can be seen here https://test-ucjlnpin5nxo.phacility.com/dashboard/view/1/
First tab panel shows content of tab 1,3,4.
Second tab panel shows content of tab 1,3.

Thanks

1 Like

I can recreate example again if you’d like, just let me know when ;).

Thank you.

Ok, I tried it on some multiple tab panels and it seems that which panel is hidden is quite random, but there is always 1 tab panel hidden, while others are visible. (Now it seems that always third tab is hidden … idk why)
Mistake is probably hidden somewhere before, after or at this line (https://secure.phabricator.com/source/phabricator/browse/master/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php$289), because there is always only one div with “display:none” style applied, but according to condition, it should work as expected … except it doesn’t … I don’t know php well, but someone might see it right away.
Thanks to anyone who can take time to look at it … it is very annoying bug to me :).

Thank you.

If you folks thought “Let’s wait, he’s gonna solve this on his own …eventually…” you were right :confused: .

Problem is originated probably here(https://secure.phabricator.com/rPa35fda2019bb2a577030779a0cbbb6dae9c7e068), where author admits, that code is not complete.

However, if you want this issue fixed, here’s what I have done to fix it:

  1. Put this line of code
    if(count($key_list) > 0){ $selected = $key_list[0]; }
    into here
    Because if there are any tabs, you don’t want 0 to be selected, you want first tab to be selected.

  2. Change this condition (here)
    'style' => ($idx == $selected) ? null : 'display: none',
    To this
    'style' => ((string)$idx === (string)$selected) ? null : 'display: none',
    so it is same condition as here, which actually works (string override is maybe overkill, but I don’t know PHP well, so I take what I saw elsewhere :slight_smile:)

There are probably deeper issues as idx is sometimes number, sometimes some random string … but after these two changes, tab panels started working as expected. So I’m happy with it.

You’re welcome.