Skip to content

Conversation

@joseph0926
Copy link
Contributor

Fixes #14526

Summary

Updates isHtmlElement() to use instanceof HTMLElement instead of checking for the presence of a tagName string property. This prevents plain data objects with a tagName property from being incorrectly identified as HTML elements.

The previous implementation would throw an error when submitting objects like { tagName: "div", data: "test" } via fetcher.submit(), as they were mistakenly treated as invalid HTML elements.

Changes

  • Updated isHtmlElement() in packages/react-router/lib/dom/dom.ts to use instanceof HTMLElement

  • I largely followed the approach described in rossipedia’s comment, and additionally only introduced the following tests and edge-case handling,

    • Added a guard for environments where HTMLElement is not defined (e.g., Node.js)
    • Added test cases to verify that plain objects with a tagName property are handled correctly

Test

  • Added new test file packages/react-router/__tests__/dom/fetcher-submit-tagname-test.tsx

@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: 5b60a1c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brophdawg11
Copy link
Contributor

Thanks! Would you mind adding a changeset via pnpm changeset?

@joseph0926
Copy link
Contributor Author

Thanks! Would you mind adding a changeset via pnpm changeset?

58f17cc

I added the changeset

@brophdawg11 brophdawg11 merged commit 68bbf9c into remix-run:dev Nov 14, 2025
5 checks passed
@brophdawg11
Copy link
Contributor

Thanks!

@joseph0926 joseph0926 deleted the fix/fetcher-submit-tagname-property branch November 15, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants