Skip to content

fix(projects): resolve nested button HTML validation error#687

Open
nino-chavez wants to merge 2 commits intoOpenCut-app:mainfrom
nino-chavez:fix/nested-button-projects-675
Open

fix(projects): resolve nested button HTML validation error#687
nino-chavez wants to merge 2 commits intoOpenCut-app:mainfrom
nino-chavez:fix/nested-button-projects-675

Conversation

@nino-chavez
Copy link

@nino-chavez nino-chavez commented Jan 29, 2026

Summary

  • Changed <button> wrappers to <div role="button"> in selection mode to avoid nesting buttons inside Checkbox (which renders as <button role="checkbox">)
  • Fixed both project card wrappers and "Select All" row

Related Issue

Fixes #675

Test plan

  • Enter selection mode on Projects page
  • Click checkboxes on project cards
  • Click "Select All" row
  • Verify no console errors about nested buttons
  • Playwright E2E test included

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Updated interactive controls on the projects page to maintain existing functionality and keyboard accessibility.

✏️ Tip: You can customize this high-level summary in your review settings.

nino-chavez and others added 2 commits January 29, 2026 14:07
Changed the selection mode wrapper from <button> to <div role="button">
to prevent nested button elements when Checkbox (which renders as a
button internally) is displayed inside the card.

This fixes the HTML validation error: "<button> cannot contain a nested <button>"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Discovered another instance of nested <button> elements in the
Select All row. Changed to <div role="button"> for consistency
with the project card fix.

Found by: Playwright E2E test for Issue OpenCut-app#675

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 29, 2026

@nino-chavez is attempting to deploy a commit to the OpenCut OSS Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Jan 29, 2026

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0f779d1

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Fixed invalid HTML nesting where button elements contained nested buttons by replacing outer buttons with divs having role="button" and tabIndex={0}, preserving all interactive behavior and keyboard handling.

Changes

Cohort / File(s) Summary
Button accessibility refactor
apps/web/src/app/projects/page.tsx
Replaced two interactive <button> elements with <div> elements having role="button" and tabIndex={0} attributes. Added explicit React.KeyboardEvent typing for keydown handler. Preserved onClick and onKeyDown behavior for selection header and project cards; Enter/Space keys continue to trigger handlers as before.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A nested button fix, oh what a sight!
No more errors in the browser's light,
Divs with roles now play the part,
Keyboard handlers warm the heart! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing a nested button HTML validation error in the projects page by replacing button elements with divs.
Description check ✅ Passed The description adequately covers the key aspects: what was changed, why it was changed, related issue, test plan, and includes verification steps. Some template sections are not filled but core information is present and complete.
Linked Issues check ✅ Passed The PR directly addresses issue #675 by eliminating nested elements through replacing wrappers with
, which resolves the console HTML validation error described in the issue.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the nested button validation error in the projects selection mode; no unrelated modifications are present beyond the stated objective.

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

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

nino-chavez added a commit to nino-chavez/OpenCut that referenced this pull request Jan 31, 2026
- Add theme toggle to Projects page header (OpenCut-app#689)
- Fix nested button HTML validation errors in header and hero (OpenCut-app#687)
  - Use asChild prop to render Links with button styles
- Add ability to add multiple keyboard shortcuts per action (OpenCut-app#696)
  - New "+" button to add additional shortcuts
  - Replace mode only removes the specific key being edited
  - Right-click to remove a shortcut when multiple exist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

[BUG] <button> cannot contain a nested <button> at local dev

1 participant