Skip to content

Commit

Permalink
fix: dropdown z-index issue (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
poulch committed Sep 19, 2023
1 parent 6fd5c38 commit ffe117c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/hooks/useFloating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import {
autoUpdate,
} from "@floating-ui/react-dom";

export const useFloating = (): UseFloatingReturn => {
return useFloatingHook({
export const useFloating = (
zIndexValue = 1
): UseFloatingReturn & {
floatingStyles: { zIndex: number };
} => {
const { floatingStyles, ...rest } = useFloatingHook({
whileElementsMounted: autoUpdate,
middleware: [
flip(),
Expand All @@ -21,4 +25,12 @@ export const useFloating = (): UseFloatingReturn => {
}),
],
});

return {
...rest,
floatingStyles: {
...floatingStyles,
zIndex: zIndexValue,
},
};
};

2 comments on commit ffe117c

@vercel
Copy link

@vercel vercel bot commented on ffe117c Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ffe117c Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

macaw-ui – ./legacy

macaw-ui.vercel.app
macaw-ui-saleorcommerce.vercel.app
macaw-ui-git-canary-saleorcommerce.vercel.app

Please sign in to comment.