File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -130,8 +130,16 @@ class SegmentedButton extends UI5Element {
130
130
await this . measureButtonsWidth ( ) ;
131
131
}
132
132
133
+ prepareToMeasureButtons ( ) {
134
+ this . style . width = "" ;
135
+ this . buttons . forEach ( button => {
136
+ button . style . width = "" ;
137
+ } ) ;
138
+ }
139
+
133
140
async measureButtonsWidth ( ) {
134
141
await RenderScheduler . whenDOMUpdated ( ) ;
142
+ this . prepareToMeasureButtons ( ) ;
135
143
136
144
this . widths = this . buttons . map ( button => {
137
145
// +1 is added because for width 100.44px the offsetWidth property returns 100px and not 101px
@@ -202,7 +210,12 @@ class SegmentedButton extends UI5Element {
202
210
}
203
211
}
204
212
205
- _handleResize ( ) {
213
+ async _handleResize ( ) {
214
+ const buttonsHaveWidth = this . widths . some ( button => button . offsetWidth > 2 ) ; // 2 are the pixel's added for rounding & IE
215
+ if ( ! buttonsHaveWidth ) {
216
+ await this . measureButtonsWidth ( ) ;
217
+ }
218
+
206
219
const parentWidth = this . parentNode . offsetWidth ;
207
220
208
221
if ( ! this . style . width || this . percentageWidthSet ) {
You can’t perform that action at this time.
0 commit comments