mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-23 16:06:45 +00:00
fix: fix various issues raised by code review
This commit is contained in:
parent
40fe7d2e52
commit
9e8ac878cc
|
@ -126,7 +126,7 @@ class TabberTransclude {
|
|||
*/
|
||||
private static function getTabHTML( array $tabData ): string {
|
||||
$tabpanelId = "tabber-tabpanel-{$tabData['id']}";
|
||||
return Html::rawElement( 'a', [
|
||||
return Html::element( 'a', [
|
||||
'class' => 'tabber__tab',
|
||||
'id' => "tabber-tab-{$tabData['id']}",
|
||||
'href' => "#$tabpanelId",
|
||||
|
|
|
@ -58,17 +58,18 @@ class Transclude {
|
|||
credentials: 'same-origin',
|
||||
signal: controller.signal
|
||||
} );
|
||||
clearTimeout( timeoutId );
|
||||
if ( !response.ok ) {
|
||||
throw new Error( `[TabberNeue] Network response was not ok: ${ response.status } - ${ response.statusText }` );
|
||||
}
|
||||
return Promise.resolve( response.text() );
|
||||
return response.text();
|
||||
} catch ( error ) {
|
||||
if ( error.name === 'AbortError' ) {
|
||||
return Promise.reject( new Error( '[TabberNeue] Request timed out after 5000ms' ) );
|
||||
} else {
|
||||
return Promise.reject( new Error( `[TabberNeue] Error fetching data from URL: ${ this.url } - ${ error }` ) );
|
||||
}
|
||||
} finally {
|
||||
clearTimeout( timeoutId );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ class TabberBuilder {
|
|||
setTabsAttributes() {
|
||||
const tabAttributes = {
|
||||
tabindex: '-1',
|
||||
'aria-selected': false
|
||||
'aria-selected': 'false'
|
||||
};
|
||||
for ( const tab of this.tablist.children ) {
|
||||
Util.setAttributes( tab, tabAttributes );
|
||||
|
@ -457,7 +457,6 @@ class TabberBuilder {
|
|||
tabberEvent.init();
|
||||
this.tabber.classList.remove( 'tabber--init' );
|
||||
this.tabber.classList.add( 'tabber--live' );
|
||||
TabberAction.setActiveTab( activeTab );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue