import React from "react" ; import ReactDOM from "react-dom" ; import { parseQuery } from "coral-common/utils" ; import { BrowserInfo } from "../lib/browserInfo" ; import { areWeInIframe } from "../utils" ; function extractQuery ( href ) { const query = href . split ( "?" ) [ 1 ] ; if ( ! query ) { return null ; } return query . split ( "#" ) [ 0 ] ; } param href export default async function potentiallyInjectAxe ( href = window . location . href , browser ) { if ( process . env . NODE_ENV !== "development" || browser . mobile ) { return ; } const query = extractQuery ( href ) ; if ( ! query || ! ( "axe" in parseQuery ( query ) ) ) { return ; } console . debug ( "injecting react-axe" ) ; const axe = ( await import ( "react-axe" ) ) . default ; axe ( React , ReactDOM , 1000 , { rules : [ { id : "page-has-heading-one" , enabled : ! areWeInIframe ( window ) , } , { id : "html-has-lang" , enabled : false , } , { id : "label" , } , ] , } ) ; }