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
DS-579 Header Height HTML Attribute #2537
DS-579 Header Height HTML Attribute #2537
Conversation
…o feature/DS-579-Header-Height-HTML-Attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Approved.
I added the optimized-resize import. throttledResize
worked because this dependency was already imported by some other components, but we should also import it here so that each package's dependencies are made explicit. Webpack will dedupe them.
When we start actually using this new data attribute, we may or may not want to switch to getBoundingClientRect()
to get the height*, but it's too soon to say. For now clientHeight
is a good choice.
*
getBoundingClientRect()
will return a fraction which can be used in a calculation with other fractions. If the header height is already rounded to an integer it may result in sub-pixel rounding issues, e.g. creating a 1px gap between the header and the sticky element we're trying to position.
@@ -2,6 +2,7 @@ import { | |||
BoltPageHeaderNav, | |||
BoltPageHeaderActionNav, | |||
} from './page-header-nav.js'; | |||
import '@bolt/core-v3.x/utils/optimized-resize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added optimized-resize import. That's where throttledResize
comes from.
Jira
https://pegadigitalit.atlassian.net/browse/DS-579
Summary
A
data-header-height
attr was added to the<header />
Details
bolt-page-header
component is added to thedata-header-height
attrdata-header-height
attr updates on resizing when the height of the header changesHow to test
Pull the branch. Check if
data-header-height
attr is added properly to thebolt-page-header
component. Check if this attr updates when the component's height changes on window resize.Release notes
data-header-height
attribute is added to thebolt-page-header
componenet.