-
Notifications
You must be signed in to change notification settings - Fork 106
fix: added resize observer for lining up progress bar #1763
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
Conversation
|
✔️ Deploy Preview for patternfly-elements ready! 🔨 Explore the source changes: 298d72c 🔍 Inspect the deploy log: https://app.netlify.com/sites/patternfly-elements/deploys/61320fd502ac7800079cec22 😎 Browse the preview: https://deploy-preview-1763--patternfly-elements.netlify.app |
…-steps-progress-bar
| - [5393d18](https://github.com/patternfly/patternfly-elements/commit/5393d185fec3b62e78037a9835470fc15adae2b3) fix: Pfe-Primary-Detail - Fixing animation jank when expanding a section in compact mode | ||
| - [04ccc7d](https://github.com/patternfly/patternfly-elements/commit/04ccc7de323bd503227d972d61707e6acb8f0b89) docs: Adjust example code block for typography classes | ||
| - [974ab6f](https://github.com/patternfly/patternfly-elements/commit/974ab6f1ab4047d4e94007d64a31e5a0cddf9b7a) fix: typos in package.json files |
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.
fixed up the commit logs.
| :host(:not([vertical])) { | ||
| width: pfe-local(size, $region: item); | ||
| min-width: fit-content; | ||
| text-align: center; |
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.
The step items only line up correctly if the width is explicitly set. fit-content was messing with it.
|
|
||
| constructor() { | ||
| super(PfeProgressSteps, { type: PfeProgressSteps.PfeType }); | ||
| this._resizeObserver = new ResizeObserver(this._build.bind(this)); |
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.
Can we add an IE11 check before this?
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 check.
| super.connectedCallback(); | ||
| this._build(); | ||
| // this will call _build initially and estabilish a resize observer for this element | ||
| this._resizeObserver.observe(this); |
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.
Can we add an IE11 check before this?
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.
checking for presence of resizeObserver first. If not, just build it one time. If it's IE11, then the _build command will catch it.
| disconnectedCallback() {} | ||
| disconnectedCallback() { | ||
| super.connectedCallback(); | ||
| this._resizeObserver.disconnect(); |
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.
Add some logic to only disconnect if this._resizeObserver is present.
kylebuch8
left a comment
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.
Leather Gloves Touch Mulch
The progress bar line is dynamically calculated based on the size of the items. Because of this, we need to add a resize event so let the progres-steps element know to recalculate the bar.
Related issues
Preview
Link(s) to demo page(s) where this element can be viewed:
What has changed and why
min-width: fit-contents:so that the--pfe-progress-steps__item--sizeproperty works as expected.Testing instructions
Verify that resize observer looks good
Verify that all items share consistent widths
Demo Snippet
Browser requirements
Your component should work in all of the following environments:
Ready-for-merge Checklist
Merging
Please squash when merging and ensure your commit message uses conventional commit formatting.
Be sure to share your updates with the patternfly-elements-contribute@redhat.com mailing list!