Ability to control where the detached modal is injected #979
                  
                    
                      sarahdayan
                    
                  
                
                  started this conversation in
                Ideas
              
            Replies: 1 comment 1 reply
-
| The fact that React Contexts are unavailable in the Autocomplete modal seems unrelated to where the modal is added in the DOM. Contexts are available from the React tree, not from the DOM tree. As long as we call  | 
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
When using
autocomplete-jsin detached mode, the modal is injected at the end of the body.This is problematic when using the library within a client-side router provider (e.g.,
react-router), especially when using child routes with components like<Outlet />which don't let you control at what level the<Router />wraps the app.Therefore, you can't use
<Link />components inside Autocomplete because it will render outside of the router.One workaround I tried exploring was to pass an
environmentwith a mockeddocument.body, but couldn't make it work so far.Maybe we could provide a
detachedContaineroption to let users render the modal wherever they want, and default it toenvironment.document.body.Beta Was this translation helpful? Give feedback.
All reactions