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) {
153
153
}
154
154
if ( pedal && pedal !== prevPedal ) {
155
155
const menu = $create ( SPLIT_BTN_MENU ,
156
+ { style : 'opacity:0' } ,
156
157
Array . from ( pedal . attributes , ( { name, value} ) =>
157
158
name . startsWith ( 'menu-' ) &&
158
159
$create ( 'a' , { tabIndex : 0 , __cmd : name . split ( '-' ) . pop ( ) } , value )
@@ -168,6 +169,14 @@ function splitMenu(event) {
168
169
pedal . after ( menu ) ;
169
170
moveFocus ( menu , 0 ) ;
170
171
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 ) ;
171
180
}
172
181
if ( entry ) {
173
182
prevPedal . previousElementSibling . dispatchEvent ( new CustomEvent ( 'split-btn' , {
You can’t perform that action at this time.
0 commit comments