Skip to content

Conversation

@browner12
Copy link
Contributor

The Problem

  • the current Tailwind pagination fails accessibility compliance for contrast. There are many that don't hit AAA, and some that don't hit even AA. This is especially apparent in the dark mode.
  • it is incredibly difficult to distinguish which page is currently selected, as the elements lack distinction between them

Here is the pagination as it currently exists, for both light and dark modes, and simple and length aware.

light-wide-before light-narrow-before dark-wide-before dark-narrow-before

Here are a couple of the more egregious contrast failures.

dark-active-contrast-before dark-dots-contrast-before dark-results-contrast-before

The Solution

I tried to approach this with as light a touch as I could, since I know this would affect current live sites. I did my best to make the diffs as simple as possible. You may also view a live playground of the changes. All changes have been synced between tailwind.blade.php and simple-tailwind.blade.php.

  • improve contrast ratios to pass AAA compliance
  • better indication of selected item
  • better indication of hovered item
  • show appropriate cursors for non-interactable elements
  • use a gap for flexed items. .justify-between alone does not guarantee space
  • remove .relative as it does not do anything
  • remove unnecessary z-indexes
  • use a simple {{ }} echo in HTML attributes, as they do not need embedded HTML
  • use rel="next" and rel="prev" consistently
  • remove .ml-3 in favor of gap spacing

Here are the results:

light-wide-after light-narrow-after dark-wide-after dark-narrow-after

- improve contrast ratios to pass AAA compliance
- better indication of selected item
- better indication hovered item
- show appropriate cursors for non-interactable elements
- use a gap for flexed items. `.justify-between` alone does not guarantee space
- move `.relative` as it does not do anything
- remove unnecessary z-indexes
- use a simple `{{ }}` echo in HTML attributes, as they do not need embedded HTML
- use `rel="next"` and `rel="prev"` consistently
@browner12
Copy link
Contributor Author

Might be easier to compare them next to each other, too:


Light Narrow

light-narrow-before
light-narrow-after

Light Wide

light-wide-before light-wide-after

Dark Narrow

dark-narrow-before
dark-narrow-after

Dark Wide

dark-wide-before dark-wide-after

@taylorotwell taylorotwell merged commit 6f88214 into laravel:12.x Nov 16, 2025
68 checks passed
@browner12 browner12 deleted the AB-tailwind-pagination-contrast branch November 16, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants