https://kotlinlang.org logo
#compose
Title
# compose
b

Brian Gardner

03/30/2020, 1:30 PM
Question about the
ModalDrawerLayout
. I added it to my sample project and it is getting drawn under the
TopAppBar
I have in the
bodyContent
of the drawer. I thought it was just clipping to that size but once I added some content to the drawer and had it fit the width and height it’s clear the drawer is just being drawn under the app bar. This seems like a bug since it goes agains the material design spec but I just wanted to make sure I wasn’t doing anything silly. Screenshots in thread
empty drawer layout under app bar
Drawer contents drawn under app bar as well
I also found that the drawer does not prevent interactions with the body content. I can click on the share icons when the drawer is open and it will trigger the click listener instead of shutting the drawer
z

Zach Klippenstein (he/him) [MOD]

03/30/2020, 3:02 PM
You probably want to use
Scaffold
. It will make sure your app bars, drawers, FAVs, and content are laid out correctly. Not sure about the touch-through issue though.
b

Brian Gardner

03/30/2020, 3:03 PM
Thanks! I’ll try it out
Using the
Scaffold
worked perfectly! The drawer is drawn over the top app bar and the content is placed correctly. The touch issue is gone with it as well. Thanks!
🎉 2
l

Leland Richardson [G]

04/03/2020, 3:02 PM
cc @matvei is there something we should change here for ModalDrawerLayout?
m

matvei

04/03/2020, 3:52 PM
Yeah I think this issue is related to the reordering due to elevation (known issue in dev08). Basically, if drawer sheet has no elevation (it should have some, according to spec, but by default now it doesn't) and topAppBar has some non-zero elevation, we reorder topAppbar to appear on the higher z index
It shouldn't be that magical, so it will work ok in the next release.
Scaffold works, because it has different layout structure, so this issue with elevation doesn't occur
(took a note to make Drawer elevation by default being proper value instead of 0)
3 Views