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

Fix pagination: make previous and next buttons accessible #2102

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9460019
Prototype
MewenLeHo Jun 23, 2023
4699306
Prototype
MewenLeHo Jun 26, 2023
55de330
Fix
MewenLeHo Jun 26, 2023
bfb234f
Prototype
MewenLeHo Jun 26, 2023
f6d4185
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jun 27, 2023
9217af7
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jun 28, 2023
23bd2e7
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jul 24, 2023
02ef7e5
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jul 24, 2023
48886f6
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jul 26, 2023
48a954a
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Jul 31, 2023
bfc5da4
New version
MewenLeHo Aug 7, 2023
812cf89
Fix
MewenLeHo Aug 7, 2023
aa2f7fa
Fix
MewenLeHo Aug 7, 2023
1aaa90a
Fix after review
MewenLeHo Aug 8, 2023
69b1bef
.
MewenLeHo Aug 8, 2023
9a352c8
Fix
MewenLeHo Aug 8, 2023
04c86fd
.
MewenLeHo Aug 9, 2023
4d151ad
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Aug 22, 2023
9d8ad6c
.
MewenLeHo Aug 22, 2023
6f753db
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Aug 23, 2023
7992576
Fix padding and gap
MewenLeHo Aug 23, 2023
fb02b56
Fix padding when no title but not a number
MewenLeHo Aug 23, 2023
0a5b410
Update migration guide
MewenLeHo Aug 23, 2023
ba98b65
.
MewenLeHo Aug 24, 2023
026d259
.
MewenLeHo Aug 24, 2023
d57ee5e
.
MewenLeHo Aug 24, 2023
15f3d6b
.
MewenLeHo Aug 24, 2023
346f5ab
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Aug 25, 2023
95c9c68
Fix version
MewenLeHo Aug 25, 2023
1a00d11
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Sep 5, 2023
f7093fb
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Sep 13, 2023
54523a8
Merge branch 'main' into main-mlh-fix-a11y-pagination
MewenLeHo Sep 22, 2023
eec7fb1
Merge branch 'main' into main-mlh-fix-a11y-pagination
louismaximepiton Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 17 additions & 9 deletions scss/_pagination.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.pagination {
// scss-docs-start pagination-css-vars
--#{$prefix}pagination-padding-x: #{$pagination-padding-x};
--#{$prefix}pagination-label-padding-x: #{$pagination-label-padding-x}; // Boosted mod
--#{$prefix}pagination-padding-y: #{$pagination-padding-y};
--#{$prefix}pagination-padding-end: #{$pagination-padding-end}; // Boosted mod
--#{$prefix}pagination-margin-y: #{$pagination-margin-y}; // Boosted mod
--#{$prefix}pagination-gap: #{$pagination-gap}; // Boosted mod
--#{$prefix}pagination-margin-x-first-last: #{$pagination-margin-x-first-last}; // Boosted mod
--#{$prefix}pagination-item-max-width: #{$pagination-item-max-width}; // Boosted mod
@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-font-weight: #{$font-weight-bold}; // Boosted mod
--#{$prefix}pagination-color: #{$pagination-color};
Expand All @@ -28,6 +30,7 @@
--#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
--#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
--#{$prefix}pagination-icon: #{$pagination-icon}; // Boosted mod
--#{$prefix}pagination-icon-min-width: #{$pagination-icon-min-width}; // Boosted mod
--#{$prefix}pagination-icon-size: #{$pagination-icon-size}; // Boosted mod
--#{$prefix}pagination-icon-width: #{$pagination-icon-width}; // Boosted mod
--#{$prefix}pagination-icon-height: #{$pagination-icon-height}; // Boosted mod
Expand All @@ -43,6 +46,7 @@
position: relative;
box-sizing: content-box; // Boosted mod
display: flex; // Boosted mod
gap: var(--#{$prefix}pagination-gap); // Boosted mod
align-items: center; // Boosted mod
justify-content: center; // Boosted mod
padding: var(--#{$prefix}pagination-padding-y) var(--#{$prefix}pagination-padding-x);
Expand All @@ -56,6 +60,7 @@
// Boosted mod: embed icon as mask-image
@include button-icon(
var(--#{$prefix}pagination-icon),
var(--#{$prefix}pagination-icon-min-width),
var(--#{$prefix}pagination-icon-size),
$size: var(--#{$prefix}pagination-icon-width) var(--#{$prefix}pagination-icon-height) ,
$selector: ".page-item:first-child .page-link, .page-item:last-child .page-link",
Expand Down Expand Up @@ -151,13 +156,16 @@
}
}

&:first-child .page-link,
&:last-child .page-link {
&:not([title]) {
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
--#{$prefix}pagination-padding-x: var(--#{$prefix}pagination-label-padding-x);
}
}

&:first-child .page-link {
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
margin-right: var(--#{$prefix}pagination-margin-x-first-last);

&:not(:empty) {
padding-right: var(--#{$prefix}pagination-padding-end);
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
}

&::before {
/* rtl:raw:
transform: scaleX(-1);
Expand All @@ -166,10 +174,6 @@
}

&:last-child .page-link {
&:not(:empty) {
padding-left: var(--#{$prefix}pagination-padding-end);
}

&::before {
order: 1;

Expand All @@ -182,6 +186,10 @@
margin-left: var(--#{$prefix}pagination-margin-x-first-last);
}

&:not(:first-child):not(:last-child) .page-link {
max-width: var(--#{$prefix}pagination-item-max-width);
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
}

@include media-breakpoint-down(sm) {
@include pagination-max-items(4);
}
Expand Down
15 changes: 11 additions & 4 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,9 @@ $dropdown-dark-header-color: $white !default; // Boosted mod
// Pagination

// scss-docs-start pagination-variables
$pagination-padding-y: null !default;
$pagination-padding-x: null !default;
$pagination-padding-y: .5625rem !default; // Boosted mod: instead of `null`
$pagination-padding-x: .8125rem !default; // Boosted mod: instead of `null`
$pagination-label-padding-x: 1.125rem !default; // Boosted mod

$pagination-font-size: $font-size-base !default;

Expand Down Expand Up @@ -1614,15 +1615,21 @@ $pagination-transition: $transition-focus !default;
// Boosted mod: no $pagination-border-radius-lg

// Boosted mod
$pagination-padding-end: 1.125rem !default;
$pagination-icon: var(--#{$prefix}chevron-icon) !default;
$pagination-icon-size: subtract($spacer * 2, calc(var(--#{$prefix}border-width) * 2)) !default; // stylelint-disable-line function-disallowed-list
$pagination-icon-min-width: .625rem !default;
$pagination-icon-size: 1.125rem !default;
Copy link
Member

Choose a reason for hiding this comment

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

These two should be named almost the same since their goal is the same. Maybe something like $pagination-icon-efficient-width/height? It add some changes to variables but it feel more handy to me. What would think about a change like this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like $pagination-icon-hitbox-width/height? Or $pagination-icon-box-width/height maybe?
Not sure which one sounds more like a Bootstrap's name?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have any idea on how to call those. Let's wait for the last review to decide ?

Copy link
Contributor Author

@MewenLeHo MewenLeHo Aug 9, 2023

Choose a reason for hiding this comment

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

Yes, it will be a job for the lead dev review 😉

Simple reminder: changing the name of $pagination-icon-size will need to be properly documented in our migration guide since it's an already existing variable.

$pagination-icon-width: add(.5rem, 1px) !default;
$pagination-icon-height: subtract(1rem, 1px) !default;
$pagination-gap: 5px !default;

$pagination-active-item-bg: $primary !default;
$pagination-active-item-color: color-contrast($pagination-active-item-bg) !default;
$pagination-active-item-border: $pagination-active-item-bg !default;

$pagination-item-max-width: $spacer * .5 !default;
// fusv-disable
$pagination-padding-end: 1.125rem !default; // Deprecated in Boosted 5.3.2 for responsive pagination
// fusv-enable
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
// End mod
// scss-docs-end pagination-variables

Expand Down
6 changes: 3 additions & 3 deletions site/content/docs/5.3/components/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Looking to use an icon or symbol in place of text for some pagination links? Be
{{< example >}}
<nav aria-label="Page navigation example with icons">
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#" aria-label="Previous"></a></li>
<li class="page-item"><a class="page-link" href="#" aria-label="Next"></a></li>
<li class="page-item"><a class="page-link" href="#" title="Previous"><span class="visually-hidden">Previous</span></a></li>
<li class="page-item"><a class="page-link" href="#" title="Next"><span class="visually-hidden">Next</span></a></li>
</ul>
</nav>
{{< /example >}}
Expand Down Expand Up @@ -139,7 +139,7 @@ To avoid pagination wrapping or overflowing, we limit the number or pagination i
<li class="page-item"><a class="page-link" href="#">8</a></li>
<li class="page-item"><a class="page-link" href="#">9</a></li>
<li class="page-item"><a class="page-link" href="#">10</a></li>
<li class="page-item"><a class="page-link" href="#" aria-label="Next"></a></li>
<li class="page-item"><a class="page-link" href="#" title="Next"><span class="visually-hidden">Next</span></a></li>
</ul>
</nav>
{{< /example >}}
Expand Down
30 changes: 30 additions & 0 deletions site/content/docs/5.3/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,43 @@ If you need more details about the changes, please refer to the [v5.3.2 release]
- **Orange navbar**
- <span class="badge bg-warning">Warning</span> The minimizing behavior with `.header-minimized` is applied to the `<header>` instead of one of its children directly.

- **Pagination**
- <span class="badge bg-warning">Warning</span> For accessibility reasons, pagination's variant with icons only has been slightly modified to ensure correct semantic for all assistive technologies. It might be a useful modification to propagate into your websites if you are using this variant.
```diff
- <li class="page-item"><a class="page-link" href="#" aria-label="Previous"></a></li>
- <li class="page-item"><a class="page-link" href="#" aria-label="Next"></a></li>
+ <li class="page-item"><a class="page-link" href="#" title="Previous"><span class="visually-hidden">Previous</span></a></li>
+ <li class="page-item"><a class="page-link" href="#" title="Next"><span class="visually-hidden">Next</span></a></li>
```
### Forms

- <span class="badge bg-success">New</span> In order to improve accessibility for people suffering from any form of color blindness, we added a visual cue to form elements on error when focused so information does not rely exclusively on color anymore. Although is has no direct impact, you might want to apply this same modification within your custom form controls if you have any.
- <span class="badge bg-success">New</span> Labels related to mandatory form fields have been improved for better accessibility. A `<span class="visually-hidden"> (required)</span>` element has been added to ensure correct restitution by assistive technologies like screen readers. Please reflect these modifications into your websites.

### CSS and Sass variables

- <details class="mb-2">
<summary><span class="badge bg-danger">Breaking</span> Deprecated CSS variables:</summary>
<ul>
<li><code>--bs-pagination-padding-end</code></li>
</ul>
</details>

- <details class="mb-2">
<summary><span class="badge bg-danger">Breaking</span> Deprecated Sass variables:</summary>
<ul>
<li><code>$pagination-padding-end</code></li>
</ul>
</details>

- <details class="mb-2">
<summary><span class="badge bg-success">New</span> CSS variables:</summary>
<ul>
<li><code>--bs-accordion-btn-hover-bg</code></li>
<li><code>--bs-pagination-gap</code></li>
<li><code>--bs-pagination-icon-min-width</code></li>
<li><code>--bs-pagination-item-max-width</code></li>
<li><code>--bs-pagination-label-padding-x</code></li>
</ul>
</details>

Expand All @@ -46,6 +72,10 @@ If you need more details about the changes, please refer to the [v5.3.2 release]
<li><code>$accordion-dark-button-hover-bg</code></li>
<li><code>$footer-accordion-active-color</code></li>
<li><code>$footer-accordion-btn-hover-bg</code></li>
<li><code>$pagination-gap</code></li>
<li><code>$pagination-icon-min-width</code></li>
<li><code>$pagination-item-max-width</code></li>
<li><code>$pagination-label-padding-x</code></li>
</ul>
</details>

Expand Down