File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -756,7 +756,10 @@ export const ChartMixin = (superClass) =>
756756 // Detect if the chart had already been initialized. This might happen in
757757 // environments where the chart is lazily attached (e.g Grid).
758758 if ( this . configuration ) {
759- this . __reflow ( ) ;
759+ const { height } = this . $ . chart . style ;
760+ this . $ . chart . style . height = '0' ;
761+ this . configuration . setSize ( null , null , false ) ;
762+ this . $ . chart . style . height = height ;
760763 return ;
761764 }
762765
Original file line number Diff line number Diff line change @@ -259,6 +259,25 @@ describe('reattach', () => {
259259 expect ( chart . configuration . inverted ) . to . be . undefined ;
260260 } ) ;
261261
262+ it ( 'should restore default height when moving from different container with defined height' , async ( ) => {
263+ chart . style . height = '100%' ;
264+ await oneEvent ( chart , 'chart-load' ) ;
265+
266+ const initialHeight = getComputedStyle ( chart ) . height ;
267+
268+ inner . style . height = '700px' ;
269+ inner . appendChild ( chart ) ;
270+ await oneEvent ( chart , 'chart-redraw' ) ;
271+
272+ expect ( getComputedStyle ( chart ) . height ) . to . be . equal ( inner . style . height ) ;
273+
274+ // Move back to first parent
275+ wrapper . appendChild ( chart ) ;
276+ await nextFrame ( ) ;
277+
278+ expect ( getComputedStyle ( chart ) . height ) . to . be . equal ( initialHeight ) ;
279+ } ) ;
280+
262281 describe ( 'series' , ( ) => {
263282 let series ;
264283
You can’t perform that action at this time.
0 commit comments