Skip to content

Commit

Permalink
Seems like getFloatingProps can take "tabIndex: undefined" as an opti…
Browse files Browse the repository at this point in the history
…on, reducing the amount of code we need to change.
  • Loading branch information
it-vegard committed Sep 22, 2023
1 parent a524196 commit 3d04aef
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions @navikt/core/react/src/popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,22 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
left: "right",
}[flPlacement.split("-")[0]];

const floatingProps = getFloatingProps({
ref: floatingRef,
style: {
position: strategy,
top: y ?? 0,
left: x ?? 0,
},
});
delete floatingProps.tabIndex;

return (
<div
className={cl("navds-popover", className, {
"navds-popover--hidden": !open || !anchorEl,
})}
data-placement={flPlacement}
aria-hidden={!open || !anchorEl}
{...floatingProps}
{...getFloatingProps({
ref: floatingRef,
style: {
position: strategy,
top: y ?? 0,
left: x ?? 0,
},
tabIndex: undefined,
})}
{...rest}
>
{children}
Expand Down

0 comments on commit 3d04aef

Please sign in to comment.