From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Fri, 18 Jul 2025 16:58:57 -0500
Subject: Fix exiting sidebar making navigation buttons clickable

This was most likely caused by Adwaita automatically making the buttons
sensitive. Though, I'm not sure. This is a backported fix.

(cherry picked from commit a5bdb36d6f3197803d1d12d0a40edc43e80367fd)

Co-authored-by: ARAKHNID <arakhnid@protonmail.com>
Origin: upstream, 48.6, commit:ab02c8806a18665a6b49053054bcecb8fcdf56c2
---
 src/ephy-window.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/ephy-window.c b/src/ephy-window.c
index 342ac06..212520d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -4848,6 +4848,12 @@ ephy_window_toggle_bookmarks (EphyWindow *self)
   state = !adw_overlay_split_view_get_show_sidebar (ADW_OVERLAY_SPLIT_VIEW (self->overlay_split_view));
   adw_overlay_split_view_set_show_sidebar (ADW_OVERLAY_SPLIT_VIEW (self->overlay_split_view), state);
 
-  if (state)
+  if (state) {
     ephy_bookmarks_dialog_focus (EPHY_BOOKMARKS_DIALOG (self->bookmarks_dialog));
+  } else {
+    EphyWebView *web_view = ephy_embed_get_web_view (self->active_embed);
+
+    /* Set the navigation flags so the buttons don't become sensitive when exiting. */
+    _ephy_window_set_navigation_flags (self, ephy_web_view_get_navigation_flags (web_view));
+  }
 }
