Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] prevent sidebar from causing horizontal page scroll on mobile
@ 2026-02-06 12:26 Rito Rhymes via ffmpeg-devel
  2026-02-09 11:59 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
  0 siblings, 1 reply; 4+ messages in thread
From: Rito Rhymes via ffmpeg-devel @ 2026-02-06 12:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: rito

When the sidebar is opened on mobile devices, it currently pushes the page content to the right, expanding the entire page width and causing horizontal scroll.

Horizontal page scrolling on mobile can be disorienting for users, impede a11y and lead to unpredictable browser behaviors.

This patch modifies the sidebar behavior on mobile to position it over / occluding the left side of the page, instead of pushing the content aside.

Additionally, because the sidebar now directly occludes page content and the hamburger icon:
- an additional overlay element covers the content to enforce separation and focus
- a close button is added to the sidebar (on mobile only) for clear dismissal

Tapping the overlay or the close button will close the sidebar and remove the overlay.

---
 htdocs/css/simple-sidebar.css | 56 ++++++++++++++++++++++++++++++-----
 src/template_footer2          | 12 +++++++-
 src/template_head2            |  3 ++
 3 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/htdocs/css/simple-sidebar.css b/htdocs/css/simple-sidebar.css
index 71a8a39..d0d6306 100644
--- a/htdocs/css/simple-sidebar.css
+++ b/htdocs/css/simple-sidebar.css
@@ -89,6 +89,15 @@
   padding: 20px;
 }
 
+/* Overlay and close button - hidden on desktop */
+.sidebar-overlay {
+  display: none;
+}
+
+.sidebar-close {
+  display: none;
+}
+
 @media (max-width:767px) {
 
 #wrapper {
@@ -97,17 +106,50 @@
 
 #sidebar-wrapper {
   left: 0;
+  margin-left: 0;
+  height: 100vh;
+  transform: translateX(-200px);
+  transition: transform 0.3s ease;
+  z-index: 1001;
 }
 
-#wrapper.active {
-  position: relative;
-  left: 200px;
+#wrapper.active #sidebar-wrapper {
+  transform: translateX(0);
 }
 
-#wrapper.active #sidebar-wrapper {
-  left: 200px;
-  width: 200px;
-  transition: all 0.4s ease 0s;
+.sidebar-close {
+  display: block;
+  position: absolute;
+  top: 0;
+  right: 0;
+  color: #999;
+  font-size: 24px;
+  text-decoration: none;
+  z-index: 1001;
+  line-height: 1;
+  padding: 20px;
+}
+
+.sidebar-close:hover,
+.sidebar-close:active,
+.sidebar-close:focus {
+  color: #fff;
+  text-decoration: none;
+}
+
+.sidebar-overlay {
+  display: none;
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100vh;
+  background: rgba(0, 0, 0, 0.5);
+  z-index: 999;
+}
+
+#wrapper.active .sidebar-overlay {
+  display: block;
 }
 
 #menu-toggle {
diff --git a/src/template_footer2 b/src/template_footer2
index 735d540..958b963 100644
--- a/src/template_footer2
+++ b/src/template_footer2
@@ -1,8 +1,18 @@
     <!-- Custom JavaScript for the Menu Toggle -->
     <script>
+      function openSidebar() {
+          $("#wrapper").addClass("active");
+      }
+      function closeSidebar() {
+          $("#wrapper").removeClass("active");
+      }
       $("#menu-toggle").click(function(e) {
           e.preventDefault();
-          $("#wrapper").toggleClass("active");
+          openSidebar();
+      });
+      $(".sidebar-close, .sidebar-overlay").click(function(e) {
+          e.preventDefault();
+          closeSidebar();
       });
     </script>
 
diff --git a/src/template_head2 b/src/template_head2
index 4f61b62..8277e3f 100644
--- a/src/template_head2
+++ b/src/template_head2
@@ -12,6 +12,7 @@
     <div id="wrapper">
 
       <nav id="sidebar-wrapper">
+        <a class="sidebar-close" href="#">&times;</a>
         <ul class="sidebar-nav">
           <li class="sidebar-brand"><a href=".">
               <img src="img/ffmpeg3d_white_20.png" alt="FFmpeg" />
@@ -54,6 +55,8 @@
         </ul>
       </nav>
 
+      <div class="sidebar-overlay"></div>
+
       <div id="page-content-wrapper">
         <header class="content-header">
           <h1>
-- 
2.51.0

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-17 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06 12:26 [FFmpeg-devel] [PATCH] prevent sidebar from causing horizontal page scroll on mobile Rito Rhymes via ffmpeg-devel
2026-02-09 11:59 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2026-02-09 13:03   ` Matthew Pellerito via ffmpeg-devel
2026-02-17 20:46   ` Rito Rhymes via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git