Skip to content

Ftable make cells clickable#1083

Closed
MCFK wants to merge 6 commits intomainfrom
feat/clickable-cells
Closed

Ftable make cells clickable#1083
MCFK wants to merge 6 commits intomainfrom
feat/clickable-cells

Conversation

@MCFK
Copy link
Collaborator

@MCFK MCFK commented Mar 9, 2026

Gör hela cellen klickbar för interagerbara element.

  • Tester

@MCFK
Copy link
Collaborator Author

MCFK commented Mar 9, 2026

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

CHANGELOG

No commits contributing to a release was found, no changelog entries will be added for this Pull Request.

If this PR should be included in a release amend the commit message(s) to use:

  • fix: for a patch version or
  • feat: for minor version.

Read more about the release process (swedish).

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Artifact sizes

Artifact sizes in this build (unchanged artifacts collapsed below).

Artifact Files Size Change
@fkui/vue-labs (esm) 1 file(s) 249.9KiB → 251.7KiB (+1.8KiB) +0.73%
7 unchanged artifacts
Artifact Files Size
@fkui/date (esm) 1 file(s) 32.2KiB
@fkui/design 2 file(s) 187.8KiB
@fkui/logic (esm) 1 file(s) 162.3KiB
@fkui/vue (esm) 1 file(s) 1.0MiB
@fkui/vue (FBadge bundle) 1 file(s) 550.5KiB
@fkui/vue/cypress 1 file(s) 56.0KiB
@fkui/vue/selectors 1 file(s) 3.3KiB

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Förhandsgranskning 🐛 🔍

Dokumentation och exampel applikationer finns att förhandsgranska på:

Sida URL
Dokumentation https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1083/
Vue Sandbox https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1083/vue-sandbox
Applikationsmall https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1083/examples/page-layout

Senast uppdaterad 2026-03-09 12:16 UTC i gh-pages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

Walkthrough

The changes refactor event handling across FTable row and header components from input change events to explicit click handlers on both table cells (td) and input elements. This introduces cell activation via the activateCell utility and adds event propagation control. The modifications affect row selection (anchor, checkbox, radio), expansion buttons, buttons, and header selectable controls. Corresponding test updates change interaction simulation from setValue() to trigger("click"). No public API signatures are altered.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: making FTable cells clickable, which is reflected across all modified components (checkbox, radio, anchor, button, expand button, and header cells).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description is minimally detailed but clearly related to the changeset, which makes various table cells clickable across multiple component files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/clickable-cells

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/vue-labs/src/components/FTable/FTable.spec.ts`:
- Line 866: The test currently triggers clicks on the nested input ("tbody
tr:first-child input") but lacks coverage for the new cell/header click proxies;
add test cases that click the containing cell/header elements (e.g., trigger
click on the containing "td" and on the header "th") and assert that the
selection change handler is invoked exactly once per click (use the existing
selection spy or emitted event used elsewhere in this spec). Update the two
locations noted (around the existing input click at the first case and the one
at line ~898) to include a cell click and a header click with precise assertions
like toHaveBeenCalledTimes(1) or the equivalent emitted check so the
clickable-cell proxy path is covered.

In `@packages/vue-labs/src/components/FTable/ITableAnchor.vue`:
- Around line 21-24: The onClickTd function programmatically clicks the proxied
anchor (targetElement.value.click()) which can bubble back into the same td
click handler and cause re-entry or double navigation; introduce a short-lived
guard flag (e.g., isProgrammaticClick as a ref/boolean) referenced by the td
click handler and by onClickTd: set the flag true immediately before calling
targetElement.value.click(), have the td click handler return early if the flag
is true, and clear the flag after the programmatic click completes (use nextTick
or a microtask/setTimeout to reset it) so regular user clicks still work. Ensure
you update both onClickTd and the td click handler that currently processes
clicks on the cell.

In `@packages/vue-labs/src/components/FTable/ITableCheckbox.vue`:
- Around line 23-35: onClickTd currently calls column.update(row,
!checked.value, checked.value) which reverses the argument order used in
onClickInput (column.update(row, checked.value, !checked.value)); change
onClickTd to call column.update(row, checked.value, !checked.value) so td clicks
request the same state transition as input clicks, and apply the same correction
to the other identical handler referenced around lines 42-43; keep the existing
e.stopPropagation, assertRef(targetElement), and
activateCell(targetElement.value, { focus: true }) calls unchanged.

In `@packages/vue-labs/src/components/FTable/ITableHeaderSelectable.vue`:
- Around line 30-35: The onClick handler (function onClick) must early-return
when the bulk checkbox/input doesn't exist to avoid calling assertRef on a
missing ref; update onClick to check that inputRef and inputRef.value exist (or
check the selection mode is "multi") before calling assertRef(inputRef),
activateCell(...), and emit("toggle"), and simply return when the input is
absent so the single-select header won't throw.

In `@packages/vue-labs/src/components/FTable/ITableRadio.vue`:
- Around line 23-35: The td click handler onClickTd is calling column.update
with the arguments flipped compared to onClickInput, causing a different
transition; change onClickTd to call column.update(row, checked.value,
!checked.value) (same as onClickInput) after activateCell, and also fix the
other similar handler later (the other td/cell click at lines ~42-43) so all td
click paths use the same column.update(row, checked.value, !checked.value)
signature; ensure you still call assertRef(inputElement) and
activateCell(inputElement.value, { focus: true }) before the update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: de30852c-cc83-4de7-ac30-7e6860e0cbc5

📥 Commits

Reviewing files that changed from the base of the PR and between 5c5fd36 and e530cc1.

📒 Files selected for processing (7)
  • packages/vue-labs/src/components/FTable/FTable.spec.ts
  • packages/vue-labs/src/components/FTable/ITableAnchor.vue
  • packages/vue-labs/src/components/FTable/ITableButton.vue
  • packages/vue-labs/src/components/FTable/ITableCheckbox.vue
  • packages/vue-labs/src/components/FTable/ITableExpandButton.vue
  • packages/vue-labs/src/components/FTable/ITableHeaderSelectable.vue
  • packages/vue-labs/src/components/FTable/ITableRadio.vue

).toBe("false");

await wrapper.get("tbody tr:first-child input").setValue();
await wrapper.get("tbody tr:first-child input").trigger("click");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Add coverage for the new td/th click proxies.

These assertions now click the nested inputs, but the risky behavior added in this PR is the new cell/header proxy handlers. Please add cases that click the containing td/th and assert exactly one selection change, otherwise regressions in the clickable-cell path will slip through.

Also applies to: 898-898

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vue-labs/src/components/FTable/FTable.spec.ts` at line 866, The test
currently triggers clicks on the nested input ("tbody tr:first-child input") but
lacks coverage for the new cell/header click proxies; add test cases that click
the containing cell/header elements (e.g., trigger click on the containing "td"
and on the header "th") and assert that the selection change handler is invoked
exactly once per click (use the existing selection spy or emitted event used
elsewhere in this spec). Update the two locations noted (around the existing
input click at the first case and the one at line ~898) to include a cell click
and a header click with precise assertions like toHaveBeenCalledTimes(1) or the
equivalent emitted check so the clickable-cell proxy path is covered.

@Forsakringskassan Forsakringskassan deleted a comment from coderabbitai bot Mar 9, 2026
@Forsakringskassan Forsakringskassan deleted a comment from coderabbitai bot Mar 9, 2026
@Forsakringskassan Forsakringskassan deleted a comment from coderabbitai bot Mar 9, 2026
@Forsakringskassan Forsakringskassan deleted a comment from coderabbitai bot Mar 9, 2026
@Forsakringskassan Forsakringskassan deleted a comment from coderabbitai bot Mar 9, 2026
@MCFK MCFK force-pushed the feat/clickable-cells branch from e530cc1 to c5228a2 Compare March 9, 2026 12:01
@MCFK MCFK force-pushed the feat/clickable-cells branch from c5228a2 to e07c4f7 Compare March 9, 2026 12:02
@MCFK
Copy link
Collaborator Author

MCFK commented Mar 9, 2026

@coderabbitai generate unit tests

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

Request timed out after 900000ms (requestId=1196f72a-f71d-41e1-95b8-376457c8ee24)

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

✅ Actions performed

Unit Test Generation started...

@MCFK
Copy link
Collaborator Author

MCFK commented Mar 10, 2026

@coderabbitai generate unit tests

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

✅ Unit tests generated successfully!

Generated 5 test files. The changes have been created in this pull request: View PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

✅ Actions performed

Unit Test Generation started...


Unit tests generated successfully.

@MCFK MCFK closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant