File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -526,6 +526,26 @@ describe('defineCustomElement', () => {
526526 container . appendChild ( e )
527527 expect ( e . shadowRoot ! . innerHTML ) . toBe ( '<div></div>' )
528528 } )
529+
530+ // https://github.com/vuejs/core/issues/12964
531+ // Disabled because of missing support for `delegatesFocus` in jsdom
532+ // https://github.com/jsdom/jsdom/issues/3418
533+ // eslint-disable-next-line vitest/no-disabled-tests
534+ test . skip ( 'shadowRoot should be initialized with delegatesFocus' , ( ) => {
535+ const E = defineCustomElement (
536+ {
537+ render ( ) {
538+ return [ h ( 'input' , { tabindex : 1 } ) ]
539+ } ,
540+ } ,
541+ { shadowRootOptions : { delegatesFocus : true } } ,
542+ )
543+ customElements . define ( 'my-el-with-delegate-focus' , E )
544+
545+ const e = new E ( )
546+ container . appendChild ( e )
547+ expect ( e . shadowRoot ! . delegatesFocus ) . toBe ( true )
548+ } )
529549 } )
530550
531551 describe ( 'emits' , ( ) => {
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export type VueElementConstructor<P = {}> = {
5353export interface CustomElementOptions {
5454 styles ?: string [ ]
5555 shadowRoot ?: boolean
56+ shadowRootOptions ?: Omit < ShadowRootInit , 'mode' >
5657 nonce ?: string
5758 configureApp ?: ( app : App ) => void
5859}
@@ -263,7 +264,11 @@ export class VueElement
263264 )
264265 }
265266 if ( _def . shadowRoot !== false ) {
266- this . attachShadow ( { mode : 'open' } )
267+ this . attachShadow (
268+ extend ( { } , _def . shadowRootOptions , {
269+ mode : 'open' ,
270+ } ) as ShadowRootInit ,
271+ )
267272 this . _root = this . shadowRoot !
268273 } else {
269274 this . _root = this
You can’t perform that action at this time.
0 commit comments