UNPKG

@wordpress/block-library

Version:
24 lines (23 loc) • 737 B
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); // packages/block-library/src/navigation-link/shared/select-label-text.js /** * Focus the Link label text and select it. * * @param {Object} ref React ref object pointing to the label element. */ function selectLabelText(ref) { ref.current.focus(); const { ownerDocument } = ref.current; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); const range = ownerDocument.createRange(); range.selectNodeContents(ref.current); selection.removeAllRanges(); selection.addRange(range); } exports.selectLabelText = selectLabelText; //# sourceMappingURL=select-label-text.cjs.map