-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(popper): Update to use react portal as default #545
Conversation
@mannycarrera4 Can you make sure you target |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
I read the PR description and associated issue. We are already defaulting to using portals. This PR removes the option to not use a Portal. Is that what we wanted? There may be cases where not portalling content is desired. |
@NicholasBoll from what I understood, we were just using portals, but this brings up the question of if we should keep the portaling option if they don't want to portal? |
I'm not sure what that means. By default we use portals with the option to disable if necessary (in certain cases this can make focus management much easier). This API change still allows the original functionality of disabling the separation of child content from the parent (what portalling essentially does) by allowing a developer to set the // before
<Popper portal={false}>
// after
<Portal containerElement={targetRef.current?.parentElement} Full example here: // before
const BeforeComponent = () => {
const targetRef = React.useRef<HTMLDivElement>(null)
const [isOpen, setOpen] = React.useState(false)
return (
<>
<div ref={targetRef} onClick={() => setOpen(true)}>Open</div>
<Popper open={isOpen} anchorElement={targetRef.current} portal={false}>
Popper content
</Popper>
</>
)
}
// after
const AfterComponent = () => {
const targetRef = React.useRef<HTMLDivElement>(null)
const [isOpen, setOpen] = React.useState(false)
return (
<>
<div ref={targetRef} onClick={() => setOpen(true)}>Open</div>
<Popper open={isOpen} anchorElement={targetRef.current} containerElement={targetRef.current?.parentElement}>
Popper content
</Popper>
</>
)
} The |
@anicholls Is this an okay thing? No way to disable the use of Portal on a |
@NicholasBoll I might have misinterpreted the issue, i think after your explanation on the example, i think we should just default to using portal instead of ripping it out |
@anicholls @NicholasBoll I feel like we should just close this PR, most of the changes where in popper and they're being addressed in #528 thoughts? I only really just updated some readmes |
@mannycarrera4 I'm fine with closing this in favor of #528. @NicholasBoll Can you make sure #517 gets closed as part of #528 as well? Squashing 10 tickets with one PR 😂 |
Summary
Fixes: #517
Checklist
yarn test
passespackage.json
canvas-kit-react
and/orcanvas-kit-css
universal modules, ifapplicable
Additional References