Skip to content

Commit

Permalink
Fix missing search overlay in some themes like Rebalance (#40472)
Browse files Browse the repository at this point in the history
* Set body opacity to 1 when instant search overlay is displayed

* changelog

* Update condition to execute only when opacity is 0

* Set opacity to 1 always when it has incorrect value
  • Loading branch information
wojtekn authored Dec 12, 2024
1 parent a2548ca commit 412baba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix missing instant search dialog for themes like Rebalance
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class DomEventHandler extends Component {
if ( this.props.isVisible !== prevProps.isVisible ) {
this.fixBodyScroll();
}
this.fixBodyOpacity();
}

disableUnnecessaryFormAndInputAttributes() {
Expand Down Expand Up @@ -190,6 +191,14 @@ export default class DomEventHandler extends Component {
}
};

fixBodyOpacity = () => {
if ( '1' !== document.body.style.opacity ) {
// This ensures the body is visible when the search dialog opens if
// the theme changes body opacity dynamically
document.body.style.opacity = '1';
}
};

/**
* 1) When the overlay is open, we set body to fixed position.
* 2) Body would be scrolled to top, so we need to set top to where the scroll position was.
Expand Down

0 comments on commit 412baba

Please sign in to comment.