add skip link to tag page (#13485)
This commit is contained in:
parent
3b6574dd44
commit
9a693d3ac6
4 changed files with 11 additions and 12 deletions
|
|
@ -2,23 +2,22 @@ function slideSidebar(side, direction) {
|
|||
if (!document.getElementById('sidebar-wrapper-' + side)) {
|
||||
return;
|
||||
}
|
||||
const mainContent =
|
||||
document.getElementById('main-content') ||
|
||||
document.getElementById('articles-list');
|
||||
if (direction === 'intoView') {
|
||||
document.getElementById('articles-list').classList.add('modal-open');
|
||||
mainContent.classList.add('modal-open');
|
||||
document.body.classList.add('modal-open');
|
||||
document
|
||||
.getElementById('sidebar-wrapper-' + side)
|
||||
.classList.add('swiped-in');
|
||||
document
|
||||
.getElementById('articles-list')
|
||||
.addEventListener('touchmove', preventDefaultAction, false);
|
||||
mainContent.addEventListener('touchmove', preventDefaultAction, false);
|
||||
} else {
|
||||
document.getElementById('articles-list').classList.remove('modal-open');
|
||||
mainContent.classList.remove('modal-open');
|
||||
document.body.classList.remove('modal-open');
|
||||
document
|
||||
.getElementById('sidebar-wrapper-' + side)
|
||||
.classList.remove('swiped-in');
|
||||
document
|
||||
.getElementById('articles-list')
|
||||
.removeEventListener('touchmove', preventDefaultAction, false);
|
||||
mainContent.removeEventListener('touchmove', preventDefaultAction, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
data-requires-approval="<%= @tag_model.requires_approval %>"
|
||||
data-articles-since="<%= Timeframe.datetime_iso8601(params[:timeframe]) %>">
|
||||
<%= render "articles/tags/sidebar" %>
|
||||
<div class="articles-list" id="articles-list">
|
||||
<main class="articles-list" id="main-content">
|
||||
<header class="flex items-center p-2 m:p-0 m:pb-2" id="on-page-nav-controls">
|
||||
<button type="button" class="crayons-btn crayons-btn--ghost crayons-btn--icon mr-2 inline-block m:hidden" id="on-page-nav-butt-left" aria-label="nav-button-left">
|
||||
<div class="crayons-icon nav-icon ">
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
<div class="loading-articles" id="loading-articles">
|
||||
loading...
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<%= render "articles/tags/sidebar_additional" %>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
el.classList.remove("active");
|
||||
});
|
||||
|
||||
document.getElementById('articles-list').addEventListener('click', function (event) {
|
||||
document.getElementById('main-content').addEventListener('click', function (event) {
|
||||
var clickedEl = event.target;
|
||||
if (hasClass(clickedEl, "bm-initial") || hasClass(clickedEl, "bm-success")) {
|
||||
//do nothing
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ RSpec.describe "User visits articles by tag", type: :system do
|
|||
end
|
||||
|
||||
it "shows the correct articles" do
|
||||
within("#articles-list") do
|
||||
within("#main-content") do
|
||||
expect(page).to have_text(article.title)
|
||||
expect(page).to have_text(article3.title)
|
||||
expect(page).not_to have_text(article2.title)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue