TonyHaikara / silk-platform

0 stars 4 forks source link

Tabs should have a "name" attribute #23

Closed ywarnier closed 3 years ago

ywarnier commented 3 years ago

In templates/admin/index.html.twig, the tab elements (nav-items) have a "href" (which I don't think is really used) but to not have a name. This means that I cannot pass a link to someone else directly to a tab (I can only send a link to the admin "page" which includes all tabs but always sends me on the dashboard). This also makes behaviour tests more complicated, as we have to use Javascript (jQuery in this case) to find the tab element and click on it.

Adding a "name" attribute (after the "role" attribute, for example), like below, would probably solve the issue.

<a class="nav-link {% if (tab is defined and (tab == 'home' or tab == false)) or tab is not defined %}active{% endif %}" id="home-tab" data-toggle="tab" href="#content-home" role="tab" name="content-home"><i class="fas fa-home"></i> {{ 'nav.dashboard'|trans }}</a>
ywarnier commented 3 years ago

It's a bit more complicated than that, actually. Changing the name doesn't allow one to see the corresponding table, because all the tables are loaded independently from the tab, in a list of visible and invisible divs.

I'm not sure how to make this right. Probably some kind of Bootstrap way...

ywarnier commented 3 years ago

The name attribute has been added and it is now possible to load a tab directly, although it still goes through the first tab and a long wait for all tabs to be loaded (but it should be possible to work with that for the automated testing process).

af3843df6880bae694ca06524c9ef1bafb02512f