(options)
| 34938 | var _index = require("../../utilities/keytips/index"); |
| 34939 | var _useKeytipData = require("./useKeytipData"); |
| 34940 | function useKeytipRef(options) { |
| 34941 | var _a = (0, _useKeytipData.useKeytipData)(options), keytipId = _a.keytipId, ariaDescribedBy = _a.ariaDescribedBy; |
| 34942 | var contentRef = _react.useCallback(function(contentElement) { |
| 34943 | if (!contentElement) return; |
| 34944 | var targetElement = findFirstElement(contentElement, (0, _index.DATAKTP_TARGET)) || contentElement; |
| 34945 | var executeElement = findFirstElement(contentElement, (0, _index.DATAKTP_EXECUTE_TARGET)) || targetElement; |
| 34946 | var ariaElement = findFirstElement(contentElement, (0, _index.DATAKTP_ARIA_TARGET)) || executeElement; |
| 34947 | setAttribute(targetElement, (0, _index.DATAKTP_TARGET), keytipId); |
| 34948 | setAttribute(executeElement, (0, _index.DATAKTP_EXECUTE_TARGET), keytipId); |
| 34949 | setAttribute(ariaElement, "aria-describedby", ariaDescribedBy, true); |
| 34950 | }, [ |
| 34951 | keytipId, |
| 34952 | ariaDescribedBy |
| 34953 | ]); |
| 34954 | return contentRef; |
| 34955 | } |
| 34956 | function setAttribute(element, attributeName, attributeValue, append) { |
| 34957 | if (append === void 0) append = false; |
| 34958 | if (element && attributeValue) { |
nothing calls this directly
no test coverage detected