[BUG] - Using Tabs inside Modal breaks UI
HeroUI Version
2.6.14
Describe the bug
When a Modal containing Tabs is closed after switching between tabs, the modal's content remains visually present on the screen but in a "ghosted" state. This creates a UI layer that appears invisible but still occupies space and interferes with user interactions, as clicks are being intercepted by the invisible modal content.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Reproducible steps:
- Add 2 tabs inside a modal content component
- Open modal
- If tab 1 is selected, switch to tab 2
- Close modal
- The contents of the modal will still be on the screen, but not rendered(ghosted). So nothing will be clickable to the user, because the user is clicking the contents of the modal without knowing it.
Expected behavior
When the modal is closed, all of its content, including any tab components and their associated content, should be completely removed from both the DOM and visual layer. There should be no residual UI elements or invisible interactive areas remaining after the modal is closed.
Screenshots or Videos
No response
Operating System Version
macOS
Browser
Chrome
I couldn't reproduce the issue. Please share a sandbox.
https://github.com/user-attachments/assets/9dcbba58-4a1a-4dbd-88a0-d0903778ff97
I also got the same error
I also got the same problem. Changing to the second tab and closing the modal make other elements unclickable. I noticed that the div opened for the modal in the react portal stays there even if the modal is closed.
Here is a reproduction of the issue
Fresh demo with react-router-v7, of course the UI is broken because of tailwind 4, but that's another issue.
In our app, we are still on tailwind 3, the bug with Modal was found when upgrading from Remix 2 to react-router-v7.
Video :
https://github.com/user-attachments/assets/ac9f3234-4b64-482e-bf95-0d4f9a2b3f34
I'm having the same problem and I think the internal components should be cleared after the Model is closed.
I also encountered the same problem, when using tab in Modal, after clicking the tab operation, closing modal could not be clicked
I am currently experiencing the same issue.
another repo: https://heroui.chat/chat/4baad63f-3dbc-454d-a52a-5bbaccdcf010
another repo: https://heroui.chat/chat/4baad63f-3dbc-454d-a52a-5bbaccdcf010
aha that one made by me, this is a description I made for the issue ๐
I found an issue with using tabs inside modal, when I use Tabs component inside Modal and change tabs then closes the modal ( even by clicking outside it or close icon ) and try to click on any button in the UI it doesn't action, I made an example for the issue here ๐ https://heroui.app/BGewXad, after some debugging, I found that the div with data-overlay-container=true doesn't hide when modal closes. but couldn't find out how to hide it as expected!
Hi. I'm facing the same issue after updating to 2.7.5. In addition to this issue, I realized that the Tab loses all of it's animations. I found a workaround changing the motion props:
export const MOTION_PROPS = {
variants: {
enter: {
scale: 1,
y: 'var(--slide-enter)',
opacity: 1,
transition: {
scale: {
duration: 0.4,
ease: TRANSITION_EASINGS.ease
},
opacity: {
duration: 0.4,
ease: TRANSITION_EASINGS.ease
},
y: {
type: 'spring',
bounce: 0,
duration: 0.6
}
}
},
exit: {
scale: 1.1, // NextUI default 1.03
y: 'var(--slide-exit)',
opacity: 0,
transition: {
duration: 0.3,
ease: TRANSITION_EASINGS.ease
}
}
}
}
And using the new props on the Tabs component:
<Modal
scrollBehavior='inside'
shouldBlockScroll
isOpen={isOpen}
motionProps={MOTION_PROPS }
onOpenChange={onOpenChange}
size='lg'
>
<ModalContent className='min-h-[600px]'>
<ModalHeader className='flex items-center gap-2'>
<BsPeople size={18}/> {__('Gestiรณn de candidatos')}
</ModalHeader>
<ModalBody>
<Tabs
variant='underlined'
color='primary'
[...]
I forked the example you provided and added the workaround:
https://heroui.app/VjTNqLG
Hope it helps.
Downgrading framer-motion to 11.16.7 would also fix the issue. In fact, currently we are using 11.9.0. Using higher version may cause unexpected issues.
Fixes provided by @jonathanhirint and @wingkwong do not work for me on macOS 15.3.2 tried on Firefox and Chrome.
Hope to fix this problem soon.
Downgrading
framer-motionto11.16.7would also fix the issue. In fact, currently we are using11.9.0. Using higher version may cause unexpected issues.
Thanks @wingkwong
I downgraded to 11.16.7 and it worked for me
but i think we still need a fix for this
We are experiencing the same issue with modals when using tabs inside them. Unfortunately, downgrading framer-motion did not resolve the problem. Any suggestions or updates on this would be greatly appreciated.
We're having the same issue
+1
The fix is now available in beta version for 2.8.0.
The fix is now available in beta version for 2.8.0.
I tried beta7 and 6 and still not working
edit: updating framer-motion to 12.16.0 worked but i have to try this on apple products