Make Panel header scrollable (together with content)
On mobile when the header text is long (like for a news article) it could take up most of the display and leave just a couple of lines for the main content which makes it almost unusable.
For now I'm adding css to make the header font a lot smaller than the default size to sort of get around the issue but it would be great to have the option to make the header scroll together with the main content.
Thanks, Hamed
I think the intent of Panel is to show a sticky header, regardless of its content. Have you considered other methods, such as guaranteeing headers of a max length or shortening the header if a user scrolls?
I will tag this as a feature request, but given my observations above I'm not sure if it will have priority to be worked on. For now, I've actually created a workaround that uses styling to make the header and footer scrollable along with the content. Please note that this is somewhat brittle as it has to erase styling from Panel in order to work correctly.
thanks for your reply and the workaround. I get it that the intent is to have a sticky header, but as you can see it fails to handle a very common use case. I have a news component that fetches Sharepoint modern pages and show them in panels when you click on them. I don't see any other component in fabric UI that suits this application any better.
Also it's very common to have a news header that's 10-15 words. It doesn't make sense that on a cellphone you would lose 80% of the screen to the header with 2 lines at the bottom to scroll and read the main content. In my opinion it makes sense to have the sticky header as default and the possibility of turning it off in cases like mine.
And regardless of the stickiness, the styling of the header right now is not mobile friendly. The font size and all the margins for the controls and the header itself make them take half of the display on mobile.
Hamed
I'm not sure it makes sense for a header to initially take up 80% of screen real estate, even if it is scrollable. I don't think it should be a particularly common use case, either.
How about not rendering a header and creating a stylized title as part of the content? That would give you more control over it while making it scrollable.
Talking with @joschect he raised a good point that Panel is probably doing too much here, rather than not enough. Panel should simply be a div that renders to the side and is perhaps scrollable by default.
The business of showing a header, footer, etc. and deciding which of these elements are scrollable should be a specialized variant of Panel, and it would contain the logic for properly rendering them. In this case, someone had an opinionated idea of what Panel would be which doesn't fit all scenarios.
I understand your point of view. If Panel didn't offer header footer etc, I'd write my own code and handle it. But since it offers those, I assume it should be mobile friendly too.
The header takes up 80% of mobile displays because the styling is not mobile friendly. Right now I've added a few lines of CSS and made it 10 times better. My point is, I'm guessing Fabric UI is supposed to be mobile friendly and responsive in general, so would be nice if every component functioned so. But me as a developer will always find a workaround in case it isn't, which is beside the point.
The elements within ms-Panel-contentInner cause issues with fabric's @media screen padding styles.
!important cannot be put into styles attributes to override.
Panel serves well as an overlay, I like the onRender override props but I feel there's one missing:
onRenderContentInner
Talking with @joschect he raised a good point that Panel is probably doing too much here, rather than not enough. Panel should simply be a div that renders to the side and is perhaps scrollable by default.
A simple base component that does not implement flex would allow cleaner UI design.
closing this as it's tracked in #7625