{"id":205,"date":"2023-08-04T10:06:47","date_gmt":"2023-08-04T09:06:47","guid":{"rendered":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/?p=205"},"modified":"2023-08-04T10:06:47","modified_gmt":"2023-08-04T09:06:47","slug":"trial-and-navigation-animating-the-navigation-section","status":"publish","type":"post","link":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/2023\/08\/04\/trial-and-navigation-animating-the-navigation-section\/","title":{"rendered":"Trial and navigation: animating the Navigation section"},"content":{"rendered":"<p>Our site header was previosly static. This meant it stayed at the top of the web page as the user scrolled down. We decided we wanted to change that, making it 'sticky', so that it followed the user as they scrolled, giving them access to the header anywhere on the page. What started off as a small project ended up changing several times until we got to the final product of a scrolling header with an animated navigation section.<\/p>\n<h2>Stage 1 \u2013 scrolling header<\/h2>\n<figure id=\"attachment_207\" aria-describedby=\"caption-attachment-207\" style=\"width: 1384px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-207 size-full\" src=\"http:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-1.png\" alt=\"University of Bath Header, Role Navigation, Main University Navigation and Extended Navigation\" width=\"1384\" height=\"192\" srcset=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-1.png 1384w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-1-300x42.png 300w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-1-1024x142.png 1024w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-1-768x107.png 768w\" sizes=\"auto, (max-width: 1384px) 100vw, 1384px\" \/><figcaption id=\"caption-attachment-207\" class=\"wp-caption-text\">The University header with navigation section<\/figcaption><\/figure>\n<p>We already had the scrolling sticky header functionality in place on our WordPress Blogs. Our former web supporter Rosie has previously discussed the development process in our <a href=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/2022\/01\/21\/remodelling-the-blog-header\/\">Remodelling the blog header blog post<\/a>. We began taking the existing WordPress CSS and Javascript, tweaking it slightly, and implementing it into our Lens design system. It took a while to gain stakeholder approval and implementation was then delayed due to the prioritisation of more important features, but we eventually launched our first iteration in September 2022.<\/p>\n<h3>Navigating the bugs<\/h3>\n<p>There were a few bugs we picked up in the review phase of this project.<\/p>\n<p>On our publishing platform, Typecase, we use sticky banners to inform the user they are viewing an unpublished page or using our training and staging platforms. Our new scrolling header was hiding these banners when the user scrolled down, confusing our content creators who could not easily differentiate between live pages and unpublished pages. We were able to fix this by implementing a few lines of JavaScript on non-production pages which detected the height of the preview banners and offset them from the header. The info stripes were something we constantly had to consider when developing the scrolling navigation as both components need to appear at the top of the page. This is important as we must make sure our Typecase preview, staging, and training all mirror the live website.<\/p>\n<figure id=\"attachment_208\" aria-describedby=\"caption-attachment-208\" style=\"width: 904px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-208 size-full\" src=\"http:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-2.png\" alt=\"A staging server page with the staging server and preview banners\" width=\"904\" height=\"358\" srcset=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-2.png 904w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-2-300x119.png 300w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-2-768x304.png 768w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-2-543x215.png 543w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><figcaption id=\"caption-attachment-208\" class=\"wp-caption-text\">A staging server page with the staging server and preview banners<\/figcaption><\/figure>\n<p>A second issue arose where the sticky header would cover up section titles when an anchor link was visited. This issue was confusing as users wouldn't be sure they were viewing the correct paragraphs. The in-page navigation on our course and guide pages uses anchor links, so it was important we resolved this issue. We were able to fix this using the \u2018scroll-padding-top\u2019 CSS property on the HTML attribute. The value is determined using the height of the header at each breakpoint and then calculating if any preview banners were present using JavaScript and a CSS Variable.<\/p>\n<figure id=\"attachment_249\" aria-describedby=\"caption-attachment-249\" style=\"width: 1024px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-249 size-large\" src=\"http:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-1024x484.png\" alt=\"An example of section titles on a course page\" width=\"1024\" height=\"484\" srcset=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-1024x484.png 1024w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-300x142.png 300w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-768x363.png 768w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-1536x726.png 1536w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42-455x215.png 455w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/06\/Screenshot-2023-06-12-at-14.56.42.png 1652w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption id=\"caption-attachment-249\" class=\"wp-caption-text\">An example of section titles on a course page<\/figcaption><\/figure>\n<h2>Stage 2 \u2013 adding the navigation section<\/h2>\n<p>We decided to extend the scrolling functionality to the navigation section. This wasn\u2019t too difficult as it only involved moving the navigation section into the .header-wrapper class in our site templates. We thought the navigation section and header took up a lot of vertical space. Our UX Designer Sam created Figma prototypes demonstrating that, as the user scrolled down, the navigation section would disappear and would reappear again when you scrolled up. Once these prototypes were approved, development began.<\/p>\n<h2>Final stage \u2013 animating the navigation section<\/h2>\n<p>Developing the animated functionality on the navigation section was the most challenging part. Since the header appears on all Lens pages, there were lots of things that had to be taken into consideration. The animated navigation section was a great opportunity to put our new review and A\/R checklists to the test. It meant that we were able to pick up bugs that might previously have gone unnoticed.<\/p>\n<p>We had to make sure other systems using the Lens stylesheet (such as our Funnelback site search software) worked like the main website. Our School of Management templates use slightly different code than the University of Bath Lens, so there were some issues that we had to resolve because of this. Clashing functionality was another issue we encountered. Modals on Course Pages were hidden below the navigation, so we had to make sure the z-index was adjusted.<\/p>\n<figure id=\"attachment_210\" aria-describedby=\"caption-attachment-210\" style=\"width: 904px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-210 size-full\" src=\"http:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-4.png\" alt=\"School of Management template \" width=\"904\" height=\"480\" srcset=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-4.png 904w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-4-300x159.png 300w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-4-768x408.png 768w, https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Picture-4-405x215.png 405w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><figcaption id=\"caption-attachment-210\" class=\"wp-caption-text\">School of management template<\/figcaption><\/figure>\n<p>When running device testing, we encountered issues that were specific to IOS devices, such as a single white line in the navigation section. On the Android stock browser, we were able to pick up a bug with the animation not behaving as expected.<\/p>\n<h2>A post-launch bug<\/h2>\n<p>While we were able to spot most issues with our review checklist, there was one that slipped through the net and had to be resolved in the days following launch. We received a support ticket from a user who was unable to click on specific tertiary links in the mobile navigation section. We also noticed that when the navigation section was hidden, it was not possible to click on elements behind the area where the navigation section would normally be.<\/p>\n<h2>Tiny changes, big difference<\/h2>\n<p>While changes like this can seem small, they make a big difference to usability and user experience. The header appears on all pages and provides access to key links. Having a sticky header allows people to click these links without the need to scroll to the top of the page. Implementing the animated navigation section allowed us to include it with the scrolling functionality but not take up too much real estate. It took us a few iterations and the resolution of various bugs to get our header to where we wanted it, but we are happy with how it has turned out.<\/p>\n<figure style=\"width: 519px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-content\/uploads\/sites\/188\/2023\/01\/Extended_nav_demo_04.gif\" alt=\"Scrolling animated extended navigation on the staff page\" width=\"519\" height=\"406\" \/><figcaption class=\"wp-caption-text\">Scrolling animated navigation section<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our site header was previosly static. This meant it stayed at the top of the web page as the user scrolled down. We decided we wanted to change that, making it 'sticky', so that it followed the user as they...<\/p>\n","protected":false},"author":1554,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[2],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-front-end-development"],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/users\/1554"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":0,"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.bath.ac.uk\/digital-content-and-development\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}