Ajax pagination is not working when we have different structure than ul.js-pager__items > li > a

Created on 30 January 2021, almost 4 years ago
Updated 25 November 2023, about 1 year ago

Problem/Motivation

We can't create a custom pagination structure because we must follow the convention:

<ul class="js-pager__items">
    <li><a class="pagination__item" href="#" aria-current="page" aria-label="Current Page, Page 1">1</a></li>
    <li><a class="pagination__item" href="#" aria-label="Page 2">2</a></li>
    <li><a class="pagination__item" href="#" aria-label="Page 3">3</a></li>
    <li><a class="pagination__item" href="#" aria-label="Page 4">4</a></li>
    <li><a class="pagination__item" href="#" aria-label="Page 5">5</a></li>
  </ul>

It means that we must have `ul.js-pager__items > li > a` toajax pagination work correctly.
But in li tag, we can use a lot of different tags like:

<a>, <abbr>, <address>, <article>, <aside>, <audio>, <b>,<bdo>, <bdi>, <blockquote>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <del>, <details>, <dfn>, <div>, <dl>, <em>, <embed>, <fieldset>, <figure>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hgroup>, <hr>, <i>, <iframe>, <img>, <input>, <ins>, <kbd>, <keygen>, <label>, <main>, <map>, <mark>, <math>, <menu>, <meter>, <nav>, <noscript>, <object>, <ol>, <output>, <p>, <picture>, <pre>, <progress>, <q>, <ruby>, <s>, <samp>, <script>, <section>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <table>, <template>, <textarea>, <time>, <ul>, <var>, <video>, <wbr>

and Text.
When we build pagination using a different structure than what I showed above it will not work.

Steps to reproduce

Create ajax pagination like on example below:

<ul class="js-pager__items">
    <li><div><a class="pagination__item" href="#" aria-current="page" aria-label="Current Page, Page 1">1</a></div></li>
    <li><div><a class="pagination__item" href="#" aria-label="Page 2">2</a></div></li>
    <li><div><a class="pagination__item" href="#" aria-label="Page 3">3</a></div></li>
    <li><div><a class="pagination__item" href="#" aria-label="Page 4">4</a></div></li>
    <li><div><a class="pagination__item" href="#" aria-label="Page 5">5</a></div></li>
  </ul>

Pagination is not working as expected (ajax is not applied to that pagination).

Proposed resolution

We should add one more selector `.js-pager__items a` that will give us a possibility to create custom pagination without any issues.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Fixed

Version

10.1

Component
Views 

Last updated about 4 hours ago

Created by

🇵🇱Poland Adam Szalapski Kielce

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024