File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ function splitMenu(event) {
153153 }
154154 if ( pedal && pedal !== prevPedal ) {
155155 const menu = $create ( SPLIT_BTN_MENU ,
156+ { style : 'opacity:0' } ,
156157 Array . from ( pedal . attributes , ( { name, value} ) =>
157158 name . startsWith ( 'menu-' ) &&
158159 $create ( 'a' , { tabIndex : 0 , __cmd : name . split ( '-' ) . pop ( ) } , value )
@@ -168,6 +169,14 @@ function splitMenu(event) {
168169 pedal . after ( menu ) ;
169170 moveFocus ( menu , 0 ) ;
170171 focusA11y . toggle ( menu . firstChild , focusA11y . get ( pedal ) ) ;
172+ new IntersectionObserver ( ( [ {
173+ intersectionRect : { width : iw } ,
174+ boundingClientRect : { width : cw } ,
175+ } ] , observer ) => {
176+ observer . disconnect ( ) ;
177+ menu . style . opacity = '' ;
178+ if ( iw < cw ) menu . style . transform = `translateX(calc(${ iw - cw } px - var(--menu-pad)))` ;
179+ } ) . observe ( menu ) ;
171180 }
172181 if ( entry ) {
173182 prevPedal . previousElementSibling . dispatchEvent ( new CustomEvent ( 'split-btn' , {
You can’t perform that action at this time.
0 commit comments