fix(pagination): align link trigger aria-label with Connect SSR#64
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aria-prohibited-attron link-mode pagination when prev/next are disabled<a>elements withouthref(page 1 prev, last page next).ConnectSSR: dead link triggers omitaria-label; navigable links keep it for icon-only slots.corexPaginationConnectwrapper instead of patching the DOM afterspreadProps.Problem
Zag
getPrevTriggerProps/getNextTriggerPropsalways setaria-label, but link mode only addshrefwhen navigation is possible. On page 1, prev is<a data-disabled>with nohref, which axe 4.11 rejects.Elixir Connect already omitted
aria-labelfor disabled link triggers on SSR. The Pagination hook used raw Zagconnect, sospreadPropsre-appliedaria-labelafterphx-mountedignore. Doc a11y tests failed on/en/pagination/patternsand/en/pagination/playground.Button mode (default) is unaffected:
aria-labelon<button disabled>is valid.Changes
corexPaginationConnect(assets/components/pagination-connect.ts)@zag-js/paginationconnectand override prev/next getters.adjustDeadLinkTriggerProps: striparia-labelwhen props have nohrefand trigger is nottype="button".assets/components/pagination.tsusescorexPaginationConnectininitApi().Tests
next_trigger disabled link omits aria-labelintest/components/pagination_test.exs.adjustDeadLinkTriggerPropsand link-mode integration inassets/test/component/pagination.test.ts.*-connect.tsfrom component subclass contract inassets/test/component/components-contract.test.ts.Build
priv/static/pagination.mjsviamix assets.build.Not changed
type={:link},to,redirect) kept for Phoenix patch/navigate and shareable URLs.Connect.prev_trigger/next_triggerlogic unchanged (already correct).Test plan
mix test test/components/pagination_test.exsnpm test -- pagination.test.tsnpm test -- components-contract.test.tscd e2e && mix test test/e2e_web/doc_routes_a11y_test.exs(pagination patterns + playground routes)