Comments (5)
Thanks for the feedback! We do briefly mention here that "by default, Modal includes a builtin ModalOverlay, which renders a backdrop over the page when a modal is open". Though you do have to scroll pretty far down to read it and it still might not be super obvious. I think we could probably add more to the custom overlay section so that it's less confusing.
from react-spectrum.
@syedtaqi95 were you able to get isDismissable
to work when set on the ModalOverlay
component? I've found that custom overlays don't receive click/press events.
from react-spectrum.
@psirenny yes, isDismissable
works fine for me when I set it directly on the ModalOverlay
.
Are you using a controlled Modal, i.e. passing isOpen
to the ModalOverlay? If so, you need to make sure that isOpen
is set to False when the onOpenChange
event fires (as per the example in the docs here).
from react-spectrum.
It's just an ordinary uncontrolled Modal. Essentially this:
<DialogTrigger>
<Button>Trigger</Button>
<ModalOverlay isDismissable>
<Modal>
<Dialog>
{/* … */}
</Dialog>
</Modal>
</ModalOverlay>
</DialogTrigger>
Adapted from the Destructive Alert Dialog example. I noticed that the Modal
component is also creating its own internal overlay (not the one specified), but it's screen hidden.
Edit: I've tried setting isDismissable
on the other components as well 😛.
from react-spectrum.
@psirenny I'm not sure why it's not working for you, sorry.
FYI, I am developing my Modal in Storybook, so the component runs in an isolated iframe. This is what I am rendering in the iframe:
<div className="mx-4 flex max-w-4xl flex-col items-center gap-8">
<DialogTrigger>
<Button>Sign up...</Button>
<ModalOverlay {...props}>
<Modal>
<Dialog>
{({ close }) => (
<>
<DialogHeading>Dialog with Button Group</DialogHeading>
<div>
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim
sint cillum sint consectetur cupidatat.
</div>
<ButtonGroup align="end" className="w-full">
<Button variant="quiet" onPress={close}>
Cancel
</Button>
<Button colour="secondary" onPress={close} autoFocus>
Confirm
</Button>
</ButtonGroup>
</>
)}
</Dialog>
</Modal>
</ModalOverlay>
</DialogTrigger>
<p className="text-justify">
Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit
enim labore culpa sint ad nisi Lorem pariatur mollit ex esse
exercitation amet. Nisi anim cupidatat excepteur officia.
Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate
voluptate dolor minim nulla est proident. Nostrud officia pariatur ut
officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit
commodo officia dolor Lorem duis laboris cupidatat officia voluptate.
Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis
officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis
sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea
consectetur et est culpa et culpa duis.
</p>
</div>
So I am simply setting the props
on the ModalOverlay which works ok for me.
from react-spectrum.
Related Issues (20)
- iOS keyboard overlaps with inputs when using useModalOverlay hook. HOT 1
- export internal types such as StyleRenderProps, ScrollableProps, etc
- When multiple slider thumbs are visually collapsed, the thumb with the highest index captures all pointer interaction. HOT 7
- The instructions for client side routing for Tantsack Router doesn't work. HOT 2
- "milliseconds" granularity for TimeField
- [RAC] inputRef is undefined in Textfield HOT 1
- [Bug] `<SearchField />` trigger `onSubmit` when pressing Enter is used for completing IME
- Section does not apply aria label HOT 1
- ComboBox Popover doesn't update if Input position changes HOT 1
- Positioning popovers relative to a virtual element (support right-click context menus) HOT 2
- Undefined unavailableDate crash in DateRangePicker when using SSR optimized localized strings
- MacOS - Safari - Show scroll bars always - Word wrap HOT 1
- Incorrect popover placement when using css `zoom` on `body`
- useSelect example typescript support HOT 1
- 'TextField' focus does not change border color (TW starter kit) HOT 1
- mpg to mp4 HOT 1
- [TreeView] Expose TreeState to TreeItem?
- React 19 support HOT 1
- MenuItem issue when target="_blank" is used HOT 1
- Warning: React does not recognize the `allowFocusWhenDisabled` prop on a DOM element. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-spectrum.