feat(ui): implement mobile responsiveness across archweb templates#646
feat(ui): implement mobile responsiveness across archweb templates#646emanuellcs wants to merge 3 commits intoarchlinux:masterfrom
Conversation
This commit introduces a responsive overlay for mobile devices (screens < 850px) while ensuring 100% visual parity for desktop views. Changes include: - templates/base.html: Added viewport meta tag for proper mobile scaling. - templates/base.html: Implemented a CSS-only hamburger menu using the "Checkbox Hack" (input#anb-toggle + label#anb-label). - sitestatic/archweb-mobile.css: Created a new override stylesheet containing all responsive logic to avoid modifying the archlinux_common_style submodule. - Homepage UX: Utilized Flexbox 'order' and 'display: contents' to resequence sections vertically: Hero -> Package Search -> Recent Updates -> Latest News. - Navigation: Added a minimalist "☰" icon for the main navbar that triggers a vertical dropdown menu on small screens. - Search: Fixed the package search typeahead (autocomplete) positioning by overriding viewport-relative JS coordinates with absolute CSS values. - Global Spacing: Applied a consistent 1.5em vertical gap between the navbar and content across all templates (Packages, News, Details, etc.). All mobile-specific elements are hidden by default (display: none) to ensure zero impact on the existing desktop design. Detailed technical documentation is included as comments within sitestatic/archweb-mobile.css for future maintenance.
Replaced the static ☰ and ✕ characters with a CSS-based animated hamburger icon to provide immediate visual feedback and a smoother transition. This eliminates the perceived delay when opening and closing the mobile menu. Implemented 0.2s ease-in-out transition for the bar-to-X transformation.
lahwaacz
left a comment
There was a problem hiding this comment.
In general, !important should not be used for styling.
The navbar style should be done in https://gitlab.archlinux.org/archlinux/archlinux-common-style
Hmm the navbar should be removed from this repository I suppose? As it uses common-style now? |
|
I think we removed it in cd9423c but maybe I missed something? |
|
Thanks for the feedback, @lahwaacz and @jelly. To clarify @lahwaacz's point: you are right, the navbar style should be central. In this PR, I didn't touch the common-style submodule; I only wrote a minimalist CSS override file (archweb-mobile.css) to test the responsiveness on archweb. I have already:
Please keep this PR on hold for now. Once I have access to GitLab, I will implement these changes directly in the archlinux-common-style repository as suggested. After that is merged, I'll update this PR to sync with the new global navbar and finalize the site-specific layout fixes (like the homepage reordering). Thanks for the guidance! |
Description
This PR introduces a minimalist, lightweight mobile responsive overlay for the
archwebsite (targeting viewports< 850px).Currently, navigating the Arch Linux website on mobile devices requires zooming and horizontal scrolling. This implementation provides a seamless mobile experience, resequencing core elements for vertical scrolling and implementing a mobile-friendly navigation menu, while strictly ensuring 100% visual parity for desktop users.
Design Philosophy & Approach
To keep the implementation as clean and non-invasive as possible, I followed these principles:
sitestatic/archweb-mobile.css). Thearchlinux_common_stylesubmodule remains completely untouched.display: none). The mobile CSS is purely an overlay that triggers via media queries, ensuring zero impact on the existing desktop design.Key Changes
<meta name="viewport">tag totemplates/base.htmlfor proper scaling on mobile browsers.input#anb-toggle+label#anb-label).0.2sease-in-out CSS animation that transforms the hamburger bars into an "X" when toggled, providing immediate visual feedback without JS event delays.orderanddisplay: contents) to logically reorder the homepage for vertical reading on small screens: Hero -> Package Search -> Recent Updates -> Latest News.1.5emvertical gap between the navbar and the main content area across all templates (Packages, News, Details, etc.) for better mobile readability.Screenshots (Mobile View)
(The images of the original versions were taken by my PC's browser, which is why they are low resolution).
(Note: Desktop view was extensively tested and remains 100% unchanged, hence omitted from these screenshots to focus on the mobile layout).
Testing Performed
Detailed technical documentation and rationale for specific CSS choices are included as comments within
sitestatic/archweb-mobile.cssto aid future maintenance.