Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG-1.x.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- [HASH](#URL) fix: Update primary-detail resize listener so it only runs with width changes

# 1.11.2 (2021-09-29)

- [ac2af8](https://github.com/patternfly/patternfly-elements/commit/ac2af8367c911af5b7cb3953eff470106c48b93b) fix: mobile-typography demo page now has correct CSS variables
Expand Down
8 changes: 8 additions & 0 deletions elements/pfe-primary-detail/src/pfe-primary-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class PfePrimaryDetail extends PFElement {
this._detailsBackButton = this.shadowRoot.getElementById("details-wrapper__back");

this._debouncedSetBreakpoint = null;
this._windowInnerWidth;

// @todo: decide if we need this anymore
// Store all focusable element types in variable
Expand Down Expand Up @@ -302,6 +303,11 @@ class PfePrimaryDetail extends PFElement {
* Then manage state of component and manage active/inactive elements
*/
_setBreakpoint() {
// We don't need to do anything if the page width is unchanged
if (this._windowInnerWidth === window.innerWidth) {
return;
}

const breakpointWas = this.breakpoint;
const breakpointIs = this.offsetWidth < this.breakpointWidth ? "compact" : "desktop";

Expand Down Expand Up @@ -344,6 +350,8 @@ class PfePrimaryDetail extends PFElement {
this._setDetailsNavVisibility(false);
}
}

this._windowInnerWidth = window.innerWidth;
}

/**
Expand Down