Skip to content

[material-ui][Pagination] getItemAriaLabel called with null page number contrary to type definition #43385

@sydneyjodon-wk

Description

@sydneyjodon-wk

Steps to reproduce

Link to live example: https://codesandbox.io/p/devbox/88qvg2?file=%2Fsrc%2FDemo.tsx

Steps:

  1. Use getItemAriaLabel
  2. Check page args that are passed in on the initial render of Pagination

Current behavior

Hello 👋

It looks like the getItemAriaLabel prop on Pagination is typed as:

getItemAriaLabel?: (type: UsePaginationItem['type'], page: number, selected: boolean) => string;

with the non-null page param, but null seems to be coming through on initial render of Pagination (see demo):

Screenshot 2024-08-20 at 4 22 21 PM ###

Expected behavior

Would it be possible to either change the behavior of passing null in for page or else change the typing of getItemAriaLabel to make it clear that null is an option for page?

Context

We are trying to use strict null safety

Your environment

See https://codesandbox.io/p/devbox/88qvg2?file=%2Fsrc%2FDemo.tsx

Thank you!

Search keywords: getItemAriaLabel page null

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGreat for first contributions. Enable to learn the contribution process.scope: paginationChanges related to the pagination.typescript

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions