[BUG] - Inconsistent Drawer/Dropdown behavior in full-screen after NextUI to HeroUI migration
HeroUI Version
2.6.14
Describe the bug
After migrating from NextUI to HeroUI, I've encountered inconsistent behavior with the Drawer and Dropdown select components, particularly in full-screen mode:
- Inconsistent appearance: The Drawer and Dropdown select components appear differently when in full-screen mode compared to their normal state.
- Behavioral differences: The components behave unexpectedly in full-screen mode, which was not the case when using NextUI.
Your Example Website or App
https://codesandbox.io/p/live/3988cbca-28a8-4bce-96da-ae9671ffdc30
Steps to Reproduce the Bug or Issue
- Implement a Drawer or Dropdown select component in a HeroUI project
- Open the Drawer or click to expand the Dropdown select in normal screen mode
- Switch to full-screen mode and repeat step 2
- Observe the differences in appearance and behavior between normal and full-screen modes
Expected behavior
- The Drawer and Dropdown select should appear and function consistently in both normal and full-screen modes
Actual behavior:
- The components behave or appear differently in full-screen mode compared to normal mode
Screenshots or Videos
There is a noticeable delay when opening the Modal or Dropdown select The components behave or appear differently in full-screen mode
Additional context:
This issue arose after transitioning from NextUI to HeroUI. The inconsistency in full-screen mode is the primary concern, as it affects the user experience and interface consistency across different viewing modes.
Operating System Version
Windows
Browser
Edge
I couldn't reproduce the issue (see sandbox). Are you setting size="full" to make it full screen? Besides, you should use `"framer-motion": "11.11.13", which is same as our internal one, as we haven't supported v12 yet.
https://github.com/user-attachments/assets/1a4e61c9-b40e-4338-aa25-84ad87369db5
✔ Which components would you like to add? › drawer
Adding required dependencies: @heroui/system, @heroui/theme, @heroui/drawer
npm install @heroui/system @heroui/theme @heroui/drawer
changed 4 packages, and audited 1810 packages in 12s
235 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
HeroUI CLI: Error reading package.json file: /home/issam/finance/apps/dashboard/node_modules/@heroui/drawer/package.json
Error: Error: ENOENT: no such file or directory, open '/home/issam/finance/apps/dashboard/node_modules/@heroui/drawer/package.json'
Unexpected error. Please report it as a bug:
TypeError: Cannot read properties of undefined (reading 'devDependencies')
at A (file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:23:24)
at Wt (file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:23:2307)
at file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:23:1717
at Array.forEach (<anonymous>)
at Object.content (file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:23:1699)
at le (file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:33:4078)
at Command.Eo (file:///home/ubuntu/.npm-global/lib/node_modules/heroui-cli/dist/index.js:76:1783)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Command.parseAsync (/home/ubuntu/.npm-global/lib/node_modules/heroui-cli/node_modules/commander/lib/command.js:935:5)
The Problem when i click to open drawer its open in full screen, The problem started after the latest update.
Your sandbox doesn't show this behaviour. Please share your package.json and tailwind config.
import type { Config } from "tailwindcss";
import tailwindcssAnimate from "tailwindcss-animate";
import { heroui } from "@heroui/react";
export default {
darkMode: ["class"],
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./config/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {
colors: {
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
"50": "hsl(var(--primary-50))",
"100": "hsl(var(--primary-100))",
"200": "hsl(var(--primary-200))",
"300": "hsl(var(--primary-300))",
"400": "hsl(var(--primary-400))",
"500": "hsl(var(--primary-500))",
"600": "hsl(var(--primary-600))",
"700": "hsl(var(--primary-700))",
"800": "hsl(var(--primary-800))",
"900": "hsl(var(--primary-900))",
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
"50": "hsl(var(--secondary-50))",
"100": "hsl(var(--secondary-100))",
"200": "hsl(var(--secondary-200))",
"300": "hsl(var(--secondary-300))",
"400": "hsl(var(--secondary-400))",
"500": "hsl(var(--secondary-500))",
"600": "hsl(var(--secondary-600))",
"700": "hsl(var(--secondary-700))",
"800": "hsl(var(--secondary-800))",
"900": "hsl(var(--secondary-900))",
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
sidebar: {
DEFAULT: "hsl(var(--sidebar-background))",
foreground: "hsl(var(--sidebar-foreground))",
primary: "hsl(var(--sidebar-primary))",
"primary-foreground": "hsl(var(--sidebar-primary-foreground))",
accent: "hsl(var(--sidebar-accent))",
"accent-foreground": "hsl(var(--sidebar-accent-foreground))",
border: "hsl(var(--sidebar-border))",
ring: "hsl(var(--sidebar-ring))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
popover: {
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
chart: {
"1": "hsl(var(--chart-1))",
"2": "hsl(var(--chart-2))",
"3": "hsl(var(--chart-3))",
"4": "hsl(var(--chart-4))",
"5": "hsl(var(--chart-5))",
},
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [
tailwindcssAnimate,
heroui({
themes: {
light: {
colors: {
background: "hsl(0 0% 100%)",
foreground: "hsl(240 10% 3.9%)",
primary: {
"50": "hsl(240 5.9% 96.1%)",
"100": "hsl(240 4.8% 91.9%)",
"200": "hsl(240 5.2% 84.9%)",
"300": "hsl(240 5.3% 65.1%)",
"400": "hsl(240 5.4% 55.9%)",
"500": "hsl(240 5.6% 45.1%)",
"600": "hsl(240 5.9% 35.1%)",
"700": "hsl(240 6.3% 25.1%)",
"800": "hsl(240 7.3% 15.1%)",
"900": "hsl(240 9.1% 9.8%)",
DEFAULT: "hsl(240 5.9% 10%)",
foreground: "hsl(0 0% 98%)",
},
secondary: {
"50": "hsl(240 4.8% 95.9%)",
"100": "hsl(240 4.8% 91.9%)",
"200": "hsl(240 5.2% 84.9%)",
"300": "hsl(240 5.3% 65.1%)",
"400": "hsl(240 5.4% 55.9%)",
"500": "hsl(240 5.6% 45.1%)",
"600": "hsl(240 5.9% 35.1%)",
"700": "hsl(240 6.3% 25.1%)",
"800": "hsl(240 7.3% 15.1%)",
"900": "hsl(240 9.1% 9.8%)",
DEFAULT: "hsl(240 5.2% 14.9%)",
foreground: "hsl(0 0% 98%)",
}
}
},
dark: {
colors: {
background: "hsl(240 10% 3.9%)",
foreground: "hsl(0 0% 98%)",
primary: {
"50": "hsl(0 0% 98%)",
"100": "hsl(240 5% 96%)",
"200": "hsl(240 6% 90%)",
"300": "hsl(240 5% 84%)",
"400": "hsl(240 5% 65%)",
"500": "hsl(240 4% 46%)",
"600": "hsl(240 5% 34%)",
"700": "hsl(240 5% 26%)",
"800": "hsl(240 4% 16%)",
"900": "hsl(240 6% 10%)",
DEFAULT: "hsl(240 5.9% 10%)",
foreground: "hsl(0 0% 98%)",
},
secondary: {
"50": "hsl(240 5.9% 96.1%)",
"100": "hsl(240 4.8% 91.9%)",
"200": "hsl(240 5.2% 84.9%)",
"300": "hsl(240 5.3% 65.1%)",
"400": "hsl(240 5.4% 55.9%)",
"500": "hsl(240 5.6% 45.1%)",
"600": "hsl(240 5.9% 35.1%)",
"700": "hsl(240 6.3% 25.1%)",
"800": "hsl(240 7.3% 15.1%)",
"900": "hsl(240 9.1% 9.8%)",
DEFAULT: "hsl(240 3.7% 15.9%)",
foreground: "hsl(0 0% 98%)",
}
}
}
},
}),
],
} satisfies Config;
Solution:
The issue was caused by the HeroUI styles not being properly loaded in the Tailwind configuration. In a monorepo setup, HeroUI is installed in the root workspace's node_modules directory. To fix this, we need to update the content array in the tailwind.config.ts file to include the HeroUI theme files.
Add the following line to the content array in your tailwind.config.ts:
"../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}",
This ensures that Tailwind CSS processes the HeroUI theme files correctly, resolving the inconsistent appearance and behavior in full-screen mode.
Full tailwind.config.ts example:
import type { Config } from "tailwindcss";
import { heroui } from "@heroui/theme";
const config: Config = {
content: [
// ... your existing content paths
"../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [heroui()],
};
export default config;
I hope this solution helps others who might encounter similar issues when using HeroUI in a monorepo setup.
Closing this issue as resolved. Thank you for your contribution to improving HeroUI!