@wordpress/block-editor
Version:
8 lines (7 loc) • 1.36 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/components/list-view/aria-referenced-text.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\n\n/**\n * A component specifically designed to be used as an element referenced\n * by ARIA attributes such as `aria-labelledby` or `aria-describedby`.\n *\n * @param {Object} props Props.\n * @param {import('react').ReactNode} props.children\n */\nexport default function AriaReferencedText( { children, ...props } ) {\n\tconst ref = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ref.current ) {\n\t\t\t// This seems like a no-op, but it fixes a bug in Firefox where\n\t\t\t// it fails to recompute the text when only the text node changes.\n\t\t\t// @see https://github.com/WordPress/gutenberg/pull/51035\n\t\t\tref.current.textContent = ref.current.textContent;\n\t\t}\n\t}, [ children ] );\n\n\treturn (\n\t\t<div hidden { ...props } ref={ ref }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAsBhC;AAba,SAAR,mBAAqC,EAAE,UAAU,GAAG,MAAM,GAAI;AACpE,QAAM,UAAM,uBAAO;AAEnB,gCAAW,MAAM;AAChB,QAAK,IAAI,SAAU;AAIlB,UAAI,QAAQ,cAAc,IAAI,QAAQ;AAAA,IACvC;AAAA,EACD,GAAG,CAAE,QAAS,CAAE;AAEhB,SACC,4CAAC,SAAI,QAAM,MAAG,GAAG,OAAQ,KACtB,UACH;AAEF;",
"names": []
}