Skip to content

Commit 60b8e7a

Browse files
authored
Fix tabs (#244)
1 parent e53982b commit 60b8e7a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/js/tab/tab.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,13 @@ class TabsElement extends HTMLElement {
150150
tabButton.setAttribute('aria-controls', tab.id);
151151
tabButton.setAttribute('role', 'tab');
152152
tabButton.setAttribute('type', 'button');
153-
tabButton.setAttribute('tabindex', 0);
153+
tabButton.setAttribute('tabindex', -1);
154154
tabButton.innerHTML = `${tab.getAttribute('name')}`;
155+
156+
if (tab.hasAttribute('active')) {
157+
tabButton.setAttribute('tabindex', 0);
158+
}
159+
155160
this.tabButtonContainer.appendChild(tabButton);
156161

157162
tabButton.addEventListener('click', this.activateTab);

src/scss/tab/tab.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ joomla-tab button[role=tab] {
4949
appearance: none;
5050
}
5151

52-
joomla-tab button[role=tab][aria-expanded="true"] {
52+
joomla-tab button[role=tab][aria-expanded="true"],
53+
joomla-tab button[role=tab][aria-selected="true"] {
5354
background-color: rgba(0, 0, 0, .03);
5455
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .05) 100%);
5556
border-right: 0 none;
@@ -59,7 +60,9 @@ joomla-tab button[role=tab][aria-expanded="true"] {
5960
box-shadow: 2px 0 1px -1px rgba(0, 0, 0, .08) inset, -2px 0 1px -1px rgba(0, 0, 0, .08) inset, 0 1px 0 rgba(0, 0, 0, .02) inset;
6061
}
6162

62-
joomla-tab button[aria-expanded="true"]::after {
63+
joomla-tab button[aria-expanded="true"]::after,
64+
joomla-tab button[aria-selected="true"]::after
65+
{
6366
position: absolute;
6467
right: 0;
6568
bottom: -1px;

0 commit comments

Comments
 (0)