Skip to content
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

Offcanvas inside containers other than viewport #33574

Open
iainhallam opened this issue Apr 7, 2021 · 4 comments
Open

Offcanvas inside containers other than viewport #33574

iainhallam opened this issue Apr 7, 2021 · 4 comments
Assignees

Comments

@iainhallam
Copy link

In some user interfaces, it's possible to make a drawer appear using any element with appropriate classes as the container, rather than the viewport. I'd like to use this to allow properties panes to easily be associated with different parts of the page, rather than needing to go to the window edge all the time.

A codepen for the sort of thing I'm after:

https://codepen.io/iainhallam/pen/vYywVev

If this is already possible, could it be added to the documentation, and if not, could this be a feature request, please?

@mdo
Copy link
Member

mdo commented Apr 9, 2021

I believe this is already possible, but a quick demo could be helpful for sure. Unsure what kind of potential issues the backdrop could introduce though. Might be something @GeoSot is already thinking about elsewhere.

@GeoSot GeoSot added the v5 label Apr 9, 2021
@GeoSot GeoSot self-assigned this Apr 9, 2021
@GeoSot
Copy link
Member

GeoSot commented Apr 14, 2021

@mdo when #33545 is landed, will be possible to have this feature, given a mark-up to constrain offcanvas & backdrop like below or something better

.offcanvas-parent {
  position: relative;
  overflow: hidden;

  .offcanvas {
    position: absolute;
  }
  .modal-backdrop {
    position: absolute;
    height: 100%;
    width: 100%;
  }
}

@rvanlaak
Copy link
Contributor

rvanlaak commented Jul 13, 2022

@GeoSot given the above comment, you mean that Offcanvas now can be positioned relatively inside a parent?

My use-case would be to show an offcanvas pane at the right, inside of a content div that has menus around it on the top, left and bottom. The default Offcanvas behavior on the viewport now is to show the offcanvas positioned over the top and bottom menus.

So based on the TS codepen I tried to use your css snippet, but did not manage to position the Offcanvas inside of the "Content" div: https://codepen.io/rvanlaak/pen/dympKXQ

Update: Solved ✅ Managed to change the Codepen to show the offcanvas inside of the content div

@studiolxv
Copy link

@rvanlaak I'm late to the party, but is your Codepen outdated? This functionality seems to be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants