Inline height not recalculated on resize
See original GitHub issueReact-headroom seems to force an inline style height on the headroom-wrapper
even though disableInlineStyles
is set to true. I’d be fine with this if the height would recalculate when resizing, but it doesn’t.
The official version of headroom doesn’t seem to do this on the demo site.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Making Height Recalculate on Resize [closed] - Stack Overflow
Everything works as I want, except, I've been trying to get this height to recalculate and apply to <li> and <a> on window...
Read more >line-height - CSS: Cascading Style Sheets - MDN Web Docs
The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text.
Read more >Text box resizing behavior in Figma
When creating text boxes in Figma, there are three main resizing modes that can ... In code, the height of the headline will...
Read more >Resizing an SVG When the Window is Resized in d3.js - Chartio
The browser doesn't inherently associate a width or height with an SVG unless ... an image, is that SVG is in fact not...
Read more >Implement responsive aspect ratio on window resize ... - Daily.co
So far, though, the height only gets set on resize— not on load— which ... It will set the calculated height when the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After some more testing I see that
headroom-wrapper
gets an inline height to prevent the content underneath from jumping while switching from unfixed to unpinned.Regardless, it would be nice if headroom recalculated its height.
@rusi Here’s my temporary fix:
When resizing the window, I execute
setHeaderHeight
which gets the height of my actual header element. I put it in the state of my component and then pass that in Headroom’swrapperStyle
prop. Hope that works for you! (You can probably debounce this to improve performance, but here’s a very barebones version.)Note: I use
disableInlineStyles
as I have my own transitions and styling for Headroom.@KyleAMathews What do you think?