closeOnBackdropClick works on backdrop to the left and right of image, but not above and below image
See original GitHub issueNot sure if #313 would fix this—I’m not able to look closely at it right now.
Steps to reproduce the behavior:
Tested on Chrome with npm versions 1.1.0-beta.3
, 1.1.0-beta.2
, and 1.0.0
. Also tested 1.1.0-beta.3
on Firefox and Safari. Here’s my JSX:
{/* Lightbox gallery */}
<ModalGateway>
{lightboxOpen && (
<Modal
onClose={toggleLightbox}
allowFullscreen={false}
closeOnBackdropClick={true}
>
<Carousel
currentIndex={lightboxIndex}
views={photoSources}
/>
</Modal>
)}
</ModalGateway>
My state and toggle function:
// Lightbox gallery
const [lightboxIndex, setLightboxIndex] = useState(0);
const [lightboxOpen, setLightboxOpen] = useState(false);
const toggleLightbox = index => {
setLightboxIndex(index);
setLightboxOpen(!lightboxOpen);
};
Expected behavior:
Clicks on the backdrop on all sides of the image ought to close the modal.
Actual behavior:
Only backdrop clicks to the right and left of the image close the modal, not backdrop clicks above and below the image.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:14
Top Results From Across the Web
Close react native modal by clicking on overlay?
I use TouchableWithoutFeedback since i do not want to change the background color when clicking on it. I also added onStartShouldSetResponder on the...
Read more >Modal - Bootstrap
Static backdrop. When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try...
Read more >Modal | Components - BootstrapVue
Modals are streamlined, but flexible dialog prompts powered by JavaScript and ... close on backdrop click (enabled by default), and the X close...
Read more >backdrop - CSS-Tricks
The ::backdrop CSS pseudo-element creates a backdrop that covers the entire viewport and is rendered immediately below a or any element ...
Read more >Dialog Angular UI Component - Nebular - GitHub Pages
If you are using it in a lazy loaded module than you have to install it with ... closeOnBackdropClick - close dialog on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This worked for me as a temporary fix:
Okay, so following the “Can you check if this is still present in 1.1.4?” comment I updated to 1.1.4, and it was breaking, but now I saw that the latest version is 1.1.6. There it works perfectly! 😁
Awesome job mate! Super quick fixing 💪
Thanks!