File tree Expand file tree Collapse file tree 2 files changed +3
-36
lines changed Expand file tree Collapse file tree 2 files changed +3
-36
lines changed Original file line number Diff line number Diff line change @@ -85,15 +85,6 @@ export class TabButton implements ComponentInterface, AnchorInterface {
85
85
*/
86
86
@Event ( ) ionTabButtonClick ! : EventEmitter < TabButtonClickEventDetail > ;
87
87
88
- @Listen ( 'ionTabBarLoaded' , { target : 'window' } )
89
- onTabBarLoaded ( ev : Event ) {
90
- // Only respond to events from our direct parent tab-bar
91
- const parent = this . el . parentElement ;
92
- if ( parent && parent . tagName === 'ION-TAB-BAR' && ev . target === parent ) {
93
- this . syncWithTabBar ( ) ;
94
- }
95
- }
96
-
97
88
@Listen ( 'ionTabBarChanged' , { target : 'window' } )
98
89
onTabBarChanged ( ev : CustomEvent < TabBarChangedEventDetail > ) {
99
90
const dispatchedFrom = ev . target as HTMLElement ;
@@ -114,17 +105,6 @@ export class TabButton implements ComponentInterface, AnchorInterface {
114
105
}
115
106
}
116
107
117
- private syncWithTabBar ( ) {
118
- const tabBar = this . el . parentElement as HTMLIonTabBarElement | null ;
119
- if ( tabBar && tabBar . tagName === 'ION-TAB-BAR' ) {
120
- // Check both the property and attribute to handle all initialization scenarios
121
- const selectedTab = tabBar . selectedTab ?? tabBar . getAttribute ( 'selected-tab' ) ;
122
- if ( selectedTab !== null && selectedTab !== undefined ) {
123
- this . selected = this . tab === selectedTab ;
124
- }
125
- }
126
- }
127
-
128
108
private selectTab ( ev : Event | KeyboardEvent ) {
129
109
if ( this . tab !== undefined ) {
130
110
if ( ! this . disabled ) {
Original file line number Diff line number Diff line change @@ -75,23 +75,10 @@ export class Tabs implements NavOutlet {
75
75
76
76
private updateTabBar ( ) {
77
77
const tabBar = this . el . querySelector ( 'ion-tab-bar' ) ;
78
- if ( ! tabBar ) {
79
- return ;
80
- }
81
-
82
- const tab = this . selectedTab ? this . selectedTab . tab : undefined ;
83
-
84
- // If tabs has no selected tab but tab-bar already has a selected-tab set,
85
- // don't overwrite it. This handles cases where tab-bar is used without ion-tab elements.
86
- if ( tab === undefined ) {
87
- return ;
78
+ if ( tabBar ) {
79
+ const tab = this . selectedTab ? this . selectedTab . tab : undefined ;
80
+ tabBar . selectedTab = tab ;
88
81
}
89
-
90
- if ( tabBar . selectedTab === tab ) {
91
- return ;
92
- }
93
-
94
- tabBar . selectedTab = tab ;
95
82
}
96
83
97
84
/**
You can’t perform that action at this time.
0 commit comments