Skip to content

Commit 4b872db

Browse files
committed
Move sticky CTA to end of tab order in main
1 parent 69d69de commit 4b872db

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/sticky_call_to_action.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% load wagtailcore_tags %}
22
{# call_to_action is a required field (streamblock) in the block definition #}
33

4-
<!-- Sticky block -->
5-
<div class="call-to-action__sticky">
4+
5+
<div class="call-to-action__sticky" data-sticky-cta>
66
<div class="call-to-action__inner">
77
{% if value.get_button_link_block.block_type == "modal_iframe" %}
88
<button class="call-to-action__stickybutton button" data-micromodal-trigger="iframe-embed-modal">

tbx/static_src/javascript/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,12 @@ document.addEventListener('DOMContentLoaded', () => {
4242
initComponent(Modal);
4343
initComponent(ModeSwitcher);
4444
new DesktopCloseMenus();
45+
46+
// Move sticky CTA(s) to the end of the main content for natural tab order
47+
const main = document.getElementById('main-content') || document.body;
48+
if (main) {
49+
document.querySelectorAll('[data-sticky-cta]').forEach((element) => {
50+
main.appendChild(element);
51+
});
52+
}
4553
});

0 commit comments

Comments
 (0)