@@ -4,20 +4,22 @@ import {
44 type ReactiveControllerHost ,
55} from 'lit' ;
66
7- function isARIAMixinProp ( key : string ) : key is keyof ARIAMixin {
8- return key === 'role' || key . startsWith ( 'aria' ) ;
9- }
10-
117type FACE = HTMLElement & {
128 formDisabledCallback ?( disabled : boolean ) : void ;
139} ;
1410
11+ interface InternalsControllerOptions extends Partial < ARIAMixin > {
12+ getHTMLElement ?( ) : HTMLElement ;
13+ }
14+
1515const protos = new WeakMap ( ) ;
1616
1717let constructingAllowed = false ;
1818
19- interface InternalsControllerOptions extends Partial < ARIAMixin > {
20- getHTMLElement ?( ) : HTMLElement ;
19+ globalThis . _elementInternals ??= new WeakMap < Element , ElementInternals > ( ) ;
20+
21+ function isARIAMixinProp ( key : string ) : key is keyof ARIAMixin {
22+ return key === 'role' || key . startsWith ( 'aria' ) ;
2123}
2224
2325/**
@@ -263,6 +265,8 @@ export class InternalsController implements ReactiveController, ARIAMixin {
263265 this . initializeOptions ( options ) ;
264266 InternalsController . instances . set ( host , this ) ;
265267 this . #polyfillDisabledPseudo( ) ;
268+ // Expose internals to aXe Core
269+ globalThis . _elementInternals . set ( this . host , this . internals ) ;
266270 }
267271
268272 /**
@@ -335,6 +339,8 @@ export class InternalsController implements ReactiveController, ARIAMixin {
335339
336340/** @see https://w3c.github.io/aria/#ref-for-dom-ariamixin-ariaactivedescendantelement-1 */
337341declare global {
342+ // https://github.com/webcomponents-cg/community-protocols/pull/75
343+ var _elementInternals : WeakMap < Element , ElementInternals > ; // eslint-disable-line no-var
338344 interface ARIAMixin {
339345 ariaActiveDescendantElement : Element | null ;
340346 ariaControlsElements : readonly Element [ ] | null ;
0 commit comments