"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useTemporaryFocusVisibleFix = useTemporaryFocusVisibleFix;
var _element = require("@wordpress/element");
/**
 * WordPress dependencies
 */

function useTemporaryFocusVisibleFix({
  onBlur: onBlurProp
}) {
  const [focusVisible, setFocusVisible] = (0, _element.useState)(false);
  return {
    'data-focus-visible': focusVisible || undefined,
    onFocusVisible: () => {
      (0, _element.flushSync)(() => setFocusVisible(true));
    },
    onBlur: event => {
      onBlurProp?.(event);
      setFocusVisible(false);
    }
  };
}
//# sourceMappingURL=use-temporary-focus-visible-fix.js.map