From 3d04aef902f1a4a42b7adeaf279ab0130a1c9e51 Mon Sep 17 00:00:00 2001 From: Vegard Haugstvedt Date: Fri, 22 Sep 2023 12:43:11 +0200 Subject: [PATCH] Seems like getFloatingProps can take "tabIndex: undefined" as an option, reducing the amount of code we need to change. --- @navikt/core/react/src/popover/Popover.tsx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/@navikt/core/react/src/popover/Popover.tsx b/@navikt/core/react/src/popover/Popover.tsx index 4a668bc092..70a8fc9325 100644 --- a/@navikt/core/react/src/popover/Popover.tsx +++ b/@navikt/core/react/src/popover/Popover.tsx @@ -203,16 +203,6 @@ export const Popover = forwardRef( left: "right", }[flPlacement.split("-")[0]]; - const floatingProps = getFloatingProps({ - ref: floatingRef, - style: { - position: strategy, - top: y ?? 0, - left: x ?? 0, - }, - }); - delete floatingProps.tabIndex; - return (
( })} data-placement={flPlacement} aria-hidden={!open || !anchorEl} - {...floatingProps} + {...getFloatingProps({ + ref: floatingRef, + style: { + position: strategy, + top: y ?? 0, + left: x ?? 0, + }, + tabIndex: undefined, + })} {...rest} > {children}