Skip to content

[dropzone] Address review comments on PR #4907#4918

Closed
Copilot wants to merge 15 commits into
masterfrom
copilot/fix-comments-in-review-thread
Closed

[dropzone] Address review comments on PR #4907#4918
Copilot wants to merge 15 commits into
masterfrom
copilot/fix-comments-in-review-thread

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

Applies all feedback from the Copilot review on #4907. Changes are limited to the Dropzone component added in that PR.

Changes

  • Use useButton instead of manual button semantics (DropzoneRoot.tsx): Removes hand-rolled role="button", tabIndex, aria-disabled, and onKeyDown (Enter/Space) in favour of the shared useButton hook. Adds a nativeButton prop (defaulting to false) via NonNativeButtonProps, consistent with SwitchRoot, CheckboxRoot, etc. getButtonProps is passed as the last entry in the useRenderElement props array; buttonRef is included in the ref array.

  • Guard onDraggingChange against no-op calls (DropzoneRoot.tsx): setDragging previously called onDraggingChange unconditionally on every dragenter/dragleave, which fires multiple times as the pointer moves over children. Now uses a functional state updater to compare previous state and only fires the callback on an actual transition.

    const setDragging = useStableCallback((nextDragging: boolean) => {
      setDraggingState((prev) => {
        if (prev !== nextDragging) {
          onDraggingChange?.(nextDragging);
        }
        return nextDragging;
      });
    });
  • Restore HTMLInputElement.prototype.click spy (DropzoneRoot.test.tsx): Adds inputClick.mockRestore() after the assertion; without it the spy wrapper leaks across tests since the suite uses vi.resetAllMocks() rather than restoreAllMocks().

  • Fix Space key activation timing in tests (DropzoneRoot.test.tsx): useButton fires Space activation on keyup (not keydown) for non-native elements. Updated affected tests to use fireEvent.keyUp for Space.

  • Align error message and error code (DropzoneRootContext.ts / error-codes.json): The test assertion and error-codes entry both used "DropzoneContext" while the thrown message already said "DropzoneRootContext". Both are updated to match.

mbrookes and others added 13 commits May 25, 2026 21:51
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove stale dropzone-input.json (leftover from Input → HiddenInput rename)
- Clarify onOpen JSDoc: only fires when no HiddenInput is present
- CSS modules demo: replace hardcoded hex colors with design tokens,
  wrap hover in @media (hover: hover), fix :focus → :focus-visible,
  remove redundant .input class (HiddenInput handles its own visibility)
- Tailwind demo: fix focus: → focus-visible: variants
- public-types: fix Dropzone.Props/State → Dropzone.Root.Props/State
- Update generated types.md for onOpen description change

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add './dropzone' to packages/react/package.json exports so @base-ui/react/dropzone resolves correctly
- Fix non-breaking space in 'Base UI' brand name in dropzone/page.mdx and components/page.mdx (vale MuiBrandName rule)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use 'Base\u00a0UI' as a standalone keyword to match the convention
of all other components, so docs:validate generates the correct
non-breaking space in the component index (vale MuiBrandName rule).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- CSS modules demo: replace undefined --color-gray-* vars with direct
  oklch() values; set explicit color on container to prevent currentColor
  from inheriting red from the docs demo sentinel
- Tailwind demo: replace gray-* with neutral-* (the project's defined
  color tokens) and blue-600/50/100 with available blue-500/blue-500/10
  blue-500/15 tokens; add text-neutral-900 to the container for
  correct currentColor baseline

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sions

CSS module <p> elements inherit UA default margins and line-heights
because all: revert-layer removes Tailwind preflight. Add explicit
margin: 0 and line-height to match Tailwind's preflight behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use 'Whether the component should ignore user interaction.' for disabled
- Use 'Event handler called when...' for event handler props
- Add docs link and 'Renders a <X> element.' to component JSDoc
- Simplify children description to match Dialog/Collapsible patterns
- Regenerate types.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dragging state is driven purely by browser drag events — there's
no meaningful external trigger to set it programmatically. onDraggingChange
is sufficient for observing the state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Matt <github@nospam.33m.co>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Matt <github@nospam.33m.co>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 29e3b1a
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a16142b2ad65e0008830255
😎 Deploy Preview https://deploy-preview-4918--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 26, 2026

commit: 29e3b1a

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 26, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+2.18KB(+0.47%) 🔺+693B(+0.47%)

Details of bundle changes

Performance

Total duration: 1,055.31 ms ▼-456.33 ms(-30.2%) | Renders: 50 (+0) | Paint: 1,593.95 ms ▼-671.17 ms(-29.6%)

Test Duration Renders
Tabs mount (200 instances) 206.14 ms ▼-86.89 ms(-29.7%) 4 (+0)
Slider mount (300 instances) 143.17 ms ▼-69.07 ms(-32.5%) 3 (+0)
Menu mount (300 instances) 118.39 ms ▼-54.60 ms(-31.6%) 2 (+0)
Select mount (200 instances) 126.59 ms ▼-48.46 ms(-27.7%) 3 (+0)
Menu open (500 items) 64.80 ms ▼-37.54 ms(-36.7%) 12 (+0)

…and 5 more (+2 within noise) — details


Check out the code infra dashboard for more information about this PR.

Copilot AI changed the title [WIP] Fix code based on review comments [dropzone] Address review comments on PR #4907 May 26, 2026
Copilot AI requested a review from mbrookes May 26, 2026 21:44
@mbrookes
Copy link
Copy Markdown
Member

Copilot opened the review PR against master instead of the fork. Closing.

@mbrookes mbrookes closed this May 26, 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.

2 participants