tabs: remove active tab from tab order #726

This commit is contained in:
Sören Weber 2023-11-19 00:55:23 +01:00
parent b5d8b1cc31
commit 1b0e888861
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 3 additions and 3 deletions

View file

@ -74,7 +74,7 @@
{{- range $idx, $tab := $tabs }} {{- range $idx, $tab := $tabs }}
<button <button
data-tab-item="{{ .itemid }}" data-tab-item="{{ .itemid }}"
class="tab-nav-button tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }} class="tab-nav-button tab-panel-style cstyle {{ .style }}{{ cond (eq $idx 0) " active" ""}}"{{ if .color }} style="--VARIABLE-BOX-color: {{ .color }};"{{ end }}{{ if eq $idx 0 }} tabindex="-1"{{ end }}
onclick="switchTab('{{ $groupid }}','{{ .itemid }}')" onclick="switchTab('{{ $groupid }}','{{ .itemid }}')"
> >
<span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}&#8203;{{ end }}</span> <span class="tab-nav-text">{{ if .icon }}<i class="{{ .icon }}"></i>{{ end }}{{ if and .icon .title }} {{ end }}{{ .title | $page.RenderString }}{{ if (not .title) }}&#8203;{{ end }}</span>

View file

@ -115,8 +115,8 @@ function switchTab(tabGroup, tabId) {
var yposButton = event.target.getBoundingClientRect().top; var yposButton = event.target.getBoundingClientRect().top;
} }
allTabItems && allTabItems.forEach( function( e ){ e.classList.remove( 'active' ); }); allTabItems && allTabItems.forEach( function( e ){ e.classList.remove( 'active' ); e.removeAttribute( 'tabindex' ); });
targetTabItems && targetTabItems.forEach( function( e ){ e.classList.add( 'active' ); }); targetTabItems && targetTabItems.forEach( function( e ){ e.classList.add( 'active' ); e.setAttribute( 'tabindex', '-1' ); });
if(isButtonEvent){ if(isButtonEvent){
initMermaid( true ); initMermaid( true );