nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - hidden prop of Table.Pagination doesn't work

Open buskerone opened this issue 2 years ago • 1 comments

Describe the bug

Table.Pagination component has a prop called hidden. This prop should hide Table.Pagination, but for some reason it doesn't work and it's still visible.

e.g

      <Table.Pagination
        noMargin
        align="center"
        rowsPerPage={rows}
        hidden
      />

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Create a basic table with Table.Pagination
  2. Add the prop hidden
  3. Check if the Table.Pagination is visible

Expected behavior

hidden prop of Table.Pagination should work correctly.

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

buskerone avatar Sep 14 '22 17:09 buskerone

This is perfectly legal behavior (as per specs), maybe not expected but not a bug per se I think:

Changing the display CSS value of an element with the hidden attribute overrides the behavior. For instance, an element styled display: flex will be displayed on screen regardless of the hidden attribute being present.

NextUI: https://github.com/nextui-org/nextui/blob/main/packages/react/src/pagination/pagination.styles.ts#L229

Relation: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Apr/0094.html

Sylvenas avatar Sep 18 '22 07:09 Sylvenas

@Sylvenas thanks for the explanation, that makes sense. But I think what doesn't make sense is to have a prop that doesn't do the work.

There is a prop called hideHeader for Table.Column, maybe we can think of something similar for the pagination component?

buskerone avatar Sep 22 '22 15:09 buskerone

Hey @buskerone as @Sylvenas explained the hidden prop comes from the native web API for any HTML element, Pagination doesn't include it as a prop, here's the available Pagination API https://nextui.org/docs/components/pagination#pagination-props

Screen Shot 2022-09-22 at 14 47 15

jrgarciadev avatar Sep 22 '22 17:09 jrgarciadev