Skip to content

Mantine: node props render a button inside a button - #41

Merged
ashalugin merged 12 commits into
masterfrom
7-bug-mantine-node-props-render-a-button-inside-a-button
Nov 28, 2026
Merged

ashalugin merged 12 commits into
masterfrom
7-bug-mantine-node-props-render-a-button-inside-a-button

Conversation

@cherepanov

@cherepanov cherepanov commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the nested-slot component picker with a non-<button> control and open it on pointerdown so it works inside HTML5 drag hosts (e.g. MtButton sections).
  • Enable leftSection / rightSection as node on MtButton.
  • Select nested editable nodes on pointerdown so HTML5 drag does not cancel the click.
  • Closes [Bug] Mantine: node props render a button inside a button #7

Packages affected

  • @react-form-builder/designer
  • @react-form-builder/components-mantine

Checklist

  • I followed CONTRIBUTION.md and CONTRIBUTING.md
  • I ran npm run check-all locally (or explain why not) — not run for this draft PR open; focused component coverage is in tests/component/tests/node-picker-in-button.spec.tsx
  • Tests updated/added under tests/ when appropriate
  • Docs updated under documentation/docs for user-facing changes
  • External contributors: I have signed the CLA (comment the sign phrase on this PR if CI asks)

Breaking changes / migration

None.

Restore node-in-button designer fix dropped by the master revert.
@cherepanov cherepanov added the bug Something isn't working label Nov 26, 2026
@cherepanov cherepanov self-assigned this Nov 26, 2026
@cherepanov
cherepanov requested a review from ashalugin November 26, 2026 12:44
@cherepanov
cherepanov marked this pull request as ready for review November 26, 2026 12:44
@cherepanov cherepanov added this to the 12.2.0 milestone Nov 26, 2026
cherepanov and others added 2 commits November 26, 2026 17:15
Canvas add control is no longer a nested <button>; open it via data-testid and pointerdown like the component tests.

@ashalugin ashalugin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reproduced these three issues in Chrome and confirmed they still occur at e22b2a3c.

  1. Shift-click multi-select breaks on the canvas and in the component tree. Select one component, then Shift-click a second. The second component is selected on pointerdown and deselected on click because both handlers toggle selection. Both components stay selected on master. Selection handlers
  2. The new Mantine slots can create nested native buttons in Preview and FormViewer. Use the left section picker to add an MtButton to another MtButton, then open Preview. The viewer renders a <button> inside another <button>, and React reports invalid nesting. Mantine button rendering
  3. The Add component control no longer responds to click-only activation. Calling .click() on the empty canvas’s add control opens the picker on master and has no effect on the PR. Mouse press, Enter, and Space still work. Add control handlers

At 904c0d0f, npm run check-all, 50 focused component tests, and 16 E2E tests passed across React 18 and 19. Real mouse checks also passed for opening both Mantine slot pickers, dropping a palette item into a slot, and selecting a nested checkbox. CI run

@cherepanov

Copy link
Copy Markdown
Contributor Author

This one should not be fixed, as it is entirely the user’s responsibility.

2. The new Mantine slots can create nested native buttons in Preview and FormViewer. Use the left section picker to add an MtButton to another MtButton, then open Preview. The viewer renders a <button> inside another <button>, and React reports invalid nesting. Mantine button rendering

cherepanov and others added 5 commits November 27, 2026 14:32
Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
@cherepanov
cherepanov requested a review from ashalugin November 27, 2026 16:22
@ashalugin

Copy link
Copy Markdown
Collaborator

I reproduced a floating toolbar regression on f789511a in Chrome 154 on macOS and in Playwright Chromium 159, using the React 19 designer host.

  1. Upload the form below and select mtButton1 on the canvas.
  2. Click Clone component, Remove component, or Add new element in the floating toolbar.

Expected. The action runs for mtButton1.

Actual. Selection switches to Screen and the component toolbar disappears. Clone creates no copy, Remove leaves the button in place, and Add never opens its menu.

The toolbar's mousedown appears to bubble through the React portal to the canvas ancestor. The ancestor's selection handler schedules selection of Screen on mouseup, which dismisses the toolbar before the button's click handler can run. Temporarily stopping mousedown propagation at the toolbar restored Clone with real mouse input in both browsers. Selection handler

The existing Remove E2E test dispatches a synthetic click that bypasses the mouse press and release. Remove E2E test

Reproduction form
{
  "version": "1",
  "tooltipType": "MtTooltip",
  "modalType": "MtDialog",
  "form": {
    "key": "Screen",
    "type": "Screen",
    "props": {},
    "children": [
      {
        "key": "mtButton1",
        "type": "MtButton",
        "props": {}
      }
    ]
  },
  "languages": [
    {
      "code": "en",
      "dialect": "US",
      "name": "English",
      "description": "American English",
      "bidi": "ltr"
    }
  ],
  "defaultLanguage": "en-US"
}

@ashalugin ashalugin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
Co-authored-by: Alexey Cherepanov <a@cherepanov.info>
@cherepanov
cherepanov requested a review from ashalugin November 28, 2026 08:08
@ashalugin
ashalugin merged commit 8f58fd5 into master Nov 28, 2026
7 checks passed
@ashalugin
ashalugin deleted the 7-bug-mantine-node-props-render-a-button-inside-a-button branch November 28, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Mantine: node props render a button inside a button

2 participants