@adyen/adyen-platform-experience-web
Version:

27 lines (26 loc) • 636 B
JavaScript
import { useCallback as s } from "../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import a from "../useReflex.js";
import { ALREADY_RESOLVED_PROMISE as i } from "../../utils/async/constants.js";
const r = (f) => {
const o = s(
((t, e) => {
e instanceof Element && e.setAttribute("tabindex", "-1"), t instanceof Element && (t.setAttribute("tabindex", "0"), i.then(() => t?.focus()));
}),
[]
);
return a(
s(
(t, e) => {
try {
f?.(t, e);
} finally {
o(t, e);
}
},
[f, o]
)
);
};
export {
r as default
};