Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Disabled checkboxes in selectable table do not behaves as expected #3544

Closed
nbusser opened this issue Jul 24, 2024 · 17 comments · Fixed by #3658 or #3909
Closed

[BUG] - Disabled checkboxes in selectable table do not behaves as expected #3544

nbusser opened this issue Jul 24, 2024 · 17 comments · Fixed by #3658 or #3909
Assignees
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working

Comments

@nbusser
Copy link

nbusser commented Jul 24, 2024

NextUI Version

2.4.6

Describe the bug

When I use a <Table> with a non-undefined selectionMode, all the checkboxed with isDisabled or isReadonly switch state when clicking on a table row.

Here is athe code of my simple component:

"use client";

import {
  Table,
  TableBody,
  TableCell,
  TableColumn,
  TableHeader,
  TableRow,
} from "@nextui-org/table";
import { Checkbox } from "@nextui-org/checkbox";

export default function Home() {
  return (
    <section>
      <h1>Selectable table: KO</h1>
      <Table selectionMode="single">
        <TableHeader>
          <TableColumn>Disabled</TableColumn>
          <TableColumn>Readonly</TableColumn>
        </TableHeader>
        <TableBody>
          <TableRow>
            <TableCell>
              <Checkbox isDisabled>Disabled</Checkbox>
            </TableCell>
            <TableCell>
              <Checkbox isReadOnly>Readonly</Checkbox>
            </TableCell>
          </TableRow>
        </TableBody>
      </Table>

      <h1>Unselectable table: OK</h1>
      <Table>
        <TableHeader>
          <TableColumn>Disabled</TableColumn>
          <TableColumn>Readonly</TableColumn>
        </TableHeader>
        <TableBody>
          <TableRow>
            <TableCell>
              <Checkbox isDisabled>Disabled</Checkbox>
            </TableCell>
            <TableCell>
              <Checkbox isReadOnly>Readonly</Checkbox>
            </TableCell>
          </TableRow>
        </TableBody>
      </Table>
    </section>
  );
}

Your Example Website or App

https://github.com/nbusser/nextui-issue-checkbox-tables

Steps to Reproduce the Bug or Issue

  1. pnpm i
  2. npm run dev
  3. Go on localhost:3000

Expected behavior

As a user, I expect being NOT able to change the state of a disabled/readonly checkbox within a table

Screenshots or Videos

nextui-bug.mp4

Operating System Version

macOs

Browser

Firefox

Copy link

linear bot commented Jul 24, 2024

@sohan01fw
Copy link
Contributor

@wingkwong can u please assign this issue to me? I will try to solve

@sohan01fw sohan01fw removed their assignment Jul 26, 2024
@sohan01fw
Copy link
Contributor

it has a linked pr so iam gonna look for other issue

@wingkwong
Copy link
Member

oh yes. sorry didn't see it when i assigned.

@TarasVasylivskyy
Copy link

also, when we placing the text input inside selectable row, we can't type in this input. Can we disable the 'selectOnRowClick' feature?

@komagic
Copy link

komagic commented Aug 7, 2024

navigation text in input/textarea (in table) is not support

@TarasVasylivskyy
Copy link

Is this thread still alive ? No activity here.

@sohan01fw
Copy link
Contributor

@TarasVasylivskyy it has linked pr

@TarasVasylivskyy
Copy link

@TarasVasylivskyy it has linked pr

I see, but this PR is stuck there.

@GoulartNogueira
Copy link

Reproducible examples

Simplest:

https://codesandbox.io/p/devbox/youthful-pine-9qlhqm
Notice on mode=none, the input works as expected.
On mode=single or multiple, you can't select the input field.

Complete:

Also, there's an example on documentations showing an interactive Dropdown component.
Here's another example showing how the Dropdown works perfectly, but the input doesn't:
https://codesandbox.io/p/devbox/mutable-wildflower-mljtqm

Things get even crazier if you uncomment the Switch and Checkbox.

@GoulartNogueira
Copy link

Probably related to #2324

@TarasVasylivskyy
Copy link

Probably need to create an another BUG related to inputs, or some general related to inputs and checkboxes. If @GoulartNogueira can, please do, or i will do it tomorrow.

@kevinpiac
Copy link

kevinpiac commented Aug 15, 2024

Hey guys!

Does anyone have a workaround we can use while the PR is being reviewed?

I have the same problem, but using a Switch in my table in selectionMode="multiple".

As mentioned here, it seems to be related to the tailwind group class name feature.

No matter if the Switch is read-only or disabled, the animation still triggers, although the switch "onValueChange" events are not fired.

Aug-15-2024 11-37-02

@wingkwong wingkwong self-assigned this Aug 15, 2024
@wingkwong
Copy link
Member

The solution in the linked PR is not correct. As discussed with him in private, I'll take over the fix.

@komagic
Copy link

komagic commented Sep 14, 2024

@wingkwong brother, 我的pr还能提交不 0 0

@wingkwong
Copy link
Member

@komagic it's fixed already and we'll have a release today.

@wingkwong wingkwong reopened this Sep 14, 2024
@wingkwong
Copy link
Member

Reopening - the PR includes breaking changes. Now it's rescheduled to v.2.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working
Projects
None yet
7 participants