nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - can't open dropdown in production

Open nazruldev opened this issue 2 years ago • 10 comments

NextUI Version

2.3.2

Describe the bug

can't open drodpdown in production, and you can also test it on your website, it can't be opened, even though my application is live

image

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. go to https://nextui.org/docs/components/dropdown
  2. click one of the demo dropdowns

Expected behavior

it should be open

Screenshots or Videos

No response

Operating System Version

windows

Browser

Chrome

nazruldev avatar Apr 18 '24 04:04 nazruldev

preliminary findings:

  • For NextUI element in dropdown trigger:
    • failed in prod storybook & prod doc site local storybook
    • works in local storybook & local doc site (main branch) image image
  • For non-NextUI element in dropdown trigger:
    • failing. due to filterDOMProps remove the events
  • For popover, it shows at the end of the page or somewhere else

wingkwong avatar Apr 18 '24 05:04 wingkwong

Hi,

I test the same behavior.

A better explanation for this issue is that the dropdown is open in production also, but it is placed far below (bottom) on the page.

withden avatar Apr 18 '24 06:04 withden

in my case, dropdown item ignores onPress/onClick events

YoFiq avatar Apr 18 '24 11:04 YoFiq

@YoFiq onpress/onclick issue on dropdown has been addressed in 2.3.3. Are you using this version?

wingkwong avatar Apr 18 '24 11:04 wingkwong

@wingkwong i used 2.3.2, and dropdown just ignored onPress/onClick events in menu items on version 2.3.3 dropdown not displayed menu at all

downgraded to this versions and everything works fine "@nextui-org/react": "2.2.10", "framer-motion": "^10.2.4",

YoFiq avatar Apr 18 '24 11:04 YoFiq

@YoFiq Can you share your dropdown code? I used 2.3.3 and am able to open the menu. Wondering if there is some edge cases.

wingkwong avatar Apr 18 '24 11:04 wingkwong

export const DropdownTest = ({isCondition, handleTest1, handleTest2, handleTest3}: Props) => {
	const menuOptions = useMemo(() => {
		const options = [
			{
				key: 'title_1',
				title: 'title 1',
				onPress: () => {
                                     handleTest1();
                                     handleTest2();
                                 }
			},
			{
				key: 'title_2',
				title: 'title 2',
				onPress: () => {
                                     handleTest2();
                                     handleTest3();
                                 }
			}
		];
		if (isCondition) {
			options.push({
				key: 'title_3',
				title: 'title 3',
				onPress: () => {
                                     handleTest1();
                                     handleTest3();
                                 }
			});
		}
		return options;
	}, [isCondition, handleTest1, handleTest2, handleTest3]);

	const getOptionsItems = () => {
		const dropdownChildren = menuOptions.map((menu) => (
			<DropdownItem key={menu.key} onPress={menu.onPress}>
				{menu.title}
			</DropdownItem>
		));
		return { children: dropdownChildren };
	};

	const dropdownChildren = getOptionsItems();

	return (
		<div className="flex flex-row items-center justify-between">
			<Dropdown
				classNames={{
					content: 'bg-lightUI-6 text-lightUI-1 rounded-lg',
					trigger: 'z-0 outline-none'
				}}
			>
				<DropdownTrigger>
					<div className="flex h-10 min-h-10 w-10 min-w-10 items-center justify-center rounded-lg bg-lightUI-9 2xl:h-11 2xl:w-11">
						<MoreVert height={20} width={20} />
					</div>
				</DropdownTrigger>
				<DropdownMenu
					classNames={{
						base: 'p-0'
					}}
					aria-label="Active menu"
					itemClasses={{
						title: 'group-data-[hover=true]:text-blue-light-hovered ',
						base: '!text-lightUI-1 text-sm py-2 px-3 [&>svg]:data-[hover=true]:text-blue-light-hovered [&>span>svg]:!hidden font-poppins data-[hover=true]:bg-lightUI-8'
					}}
					{...dropdownChildren}
				/>
			</Dropdown>
		</div>
	);
};

YoFiq avatar Apr 18 '24 12:04 YoFiq

@YoFiq we just released a new bug fix. Can you try on 2.3.4?

wingkwong avatar Apr 18 '24 13:04 wingkwong

Fixed in v2.3.4

wingkwong avatar Apr 18 '24 13:04 wingkwong