From 25455f3631c41009f1abf6b86dc62b7ce041ad17 Mon Sep 17 00:00:00 2001
From: Dani Palou <dani@moodle.com>
Date: Tue, 25 Feb 2020 12:48:04 +0100
Subject: [PATCH] MOBILE-3356 core: Fix number of tabs calculation on course
 page

---
 src/components/tabs/tabs.ts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts
index 4f0145056..76d6b5628 100644
--- a/src/components/tabs/tabs.ts
+++ b/src/components/tabs/tabs.ts
@@ -211,7 +211,9 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
             this.tabs.push(tab);
             this.sortTabs();
 
-            this.calculateSlides();
+            setTimeout(() => {
+                this.calculateSlides();
+            });
 
             if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) {
                 // Calculate the tabBarHeight again now that there is more than 1 tab and the bar will be seen.
@@ -383,7 +385,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
         }
 
         setTimeout(() => {
-            this.updateAriaHidden(); // Slide's update() sets aria-hidden to true, update it.
+            this.slideChanged(); // Call slide changed again, sometimes the slide active index takes a while to be updated.
         }, 400);
     }