diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Navs/Pagination/BitPagination.razor b/src/BlazorUI/Bit.BlazorUI/Components/Navs/Pagination/BitPagination.razor index 7197f079edd..beb9b6ef268 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Navs/Pagination/BitPagination.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Navs/Pagination/BitPagination.razor @@ -1,85 +1,316 @@ @namespace Bit.BlazorUI @inherits BitComponentBase -
- @if (ShowFirstButton) - { - var firstIcon = BitIconInfo.From(FirstButtonIcon, FirstButtonIconName ?? "ChevronRightEnd6 bit-pgn-trs"); - - } - - @if (ShowPreviousButton) - { - var previousIcon = BitIconInfo.From(PreviousButtonIcon, PreviousButtonIconName ?? "ChevronRight bit-pgn-trs"); - - } - - @foreach (var page in GeneratePages()) - { - var currentPage = page; - if (currentPage == -1) - { -
•••
- } - else if (currentPage == SelectedPage) +@* The pagination is a navigation landmark wrapping a list of page controls, which is the markup every + major design system settles on, so assistive technologies announce it as navigation and enumerate its + items instead of reading a bare run of buttons. + The list and its items are collapsed with display:contents so the buttons stay the direct flex items of + the root and the layout (including any gap coming through Styles.Root) is exactly what it was before the + list was introduced. The explicit list roles are there because a box removed by display:contents used to + lose its implicit semantics in some browser / screen reader combinations. + The page size selector, the summary and the go to page input sit outside of that list: none of them is one + of the pages the list enumerates, so counting them among its items would misreport how many it holds. *@ +@* GetPageHref turns every control into a link, since a range that is reachable by its own address belongs in + links rather than in buttons. The two forms are written out side by side rather than folded into one + dynamic tag: which one is rendered follows from GetPageHref alone, so a control never swaps its markup + while the selection moves. A link with no page to reach carries no href, and reports aria-disabled in + place of the disabled attribute an anchor has no use for. *@ +@* The aria-label sits before the attribute splatting so that an aria-label passed as a plain attribute + still wins over the default name of the landmark, while the id, the style, the class and the dir stay + after it and keep the ones the component renders. *@ +@if (HideOnSinglePage is false || _Count > 1) +{ +