Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Site] Fix mobile tabindex #5426

Merged
merged 8 commits into from
Feb 25, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="w3-cell-row2">
<div class="w3-cell" style="width: 50px;">
<label>
<input type="checkbox" checked id="enableTemplating" class="bigbox" />
<input type="checkbox" checked id="enableTemplating" class="bigbox" tabIndex="0" />
</label>
</div>
<div class="w3-cell w3-cell-middle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,20 @@ $(function () {
// Kick off one resize to fix all videos on page load
}).resize();

function makeTabIndicesZero() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should only make the indices zero if they're not set to a negative number? This way, if anything was explicitly removed from tab order, we don't change those.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point -- fix inbound shortly

$("[tabindex]").each((i, elem) => {
if (elem.tabIndex > 0) {
elem.setAttribute("tabindex", 0);
}
});
}

// rewrite non-zero tabindex values (UHF script can add explicit tabindices, breaking keyboard tab order)
$(window).resize(makeTabIndicesZero);

// this is sadly fragile, but should work in the majority of cases (I'm so sorry).
$(document).ready(() => { setTimeout(makeTabIndicesZero, 200); });

// Code for making sidebar sticky
var headerHolder;
var footerHolder;
Expand Down