@@ -46,8 +46,8 @@ mpl.figure = function (figure_id, websocket, ondownload, parent_element) {
4646 this . image_mode = 'full' ;
4747
4848 this . root = document . createElement ( 'div' ) ;
49- this . _root_extra_style ( this . root ) ;
5049 this . root . setAttribute ( 'style' , 'display: inline-block' ) ;
50+ this . _root_extra_style ( this . root ) ;
5151
5252 parent_element . appendChild ( this . root ) ;
5353
@@ -113,7 +113,9 @@ mpl.figure.prototype._init_canvas = function () {
113113 canvas_div . setAttribute (
114114 'style' ,
115115 'border: 1px solid #ddd;' +
116+ 'box-sizing: content-box;' +
116117 'clear: both;' +
118+ 'outline: 0;' +
117119 'overflow: hidden;' +
118120 'position: relative;' +
119121 'resize: both;'
@@ -139,7 +141,7 @@ mpl.figure.prototype._init_canvas = function () {
139141
140142 var canvas = ( this . canvas = document . createElement ( 'canvas' ) ) ;
141143 canvas . classList . add ( 'mpl-canvas' ) ;
142- canvas . setAttribute ( 'style' , 'left: 0; top: 0; z-index: 0; outline: 0 ' ) ;
144+ canvas . setAttribute ( 'style' , 'box-sizing: content-box; ' ) ;
143145
144146 this . context = canvas . getContext ( '2d' ) ;
145147
@@ -159,7 +161,7 @@ mpl.figure.prototype._init_canvas = function () {
159161 ) ) ;
160162 rubberband_canvas . setAttribute (
161163 'style' ,
162- 'position: absolute; left: 0; top: 0; z-index: 1;'
164+ 'box-sizing: content-box; position: absolute; left: 0; top: 0; z-index: 1;'
163165 ) ;
164166
165167 var resizeObserver = new ResizeObserver ( function ( entries ) {
0 commit comments