Skip to content

fix(ModalDialog): remove the unsupported as prop - #7067

Open
poplolioi11 wants to merge 3 commits into
react-bootstrap:masterfrom
poplolioi11:fix/modaldialog-existing-as
Open

poplolioi11 wants to merge 3 commits into
react-bootstrap:masterfrom
poplolioi11:fix/modaldialog-existing-as

Conversation

@poplolioi11

@poplolioi11 poplolioi11 commented Nov 4, 2026 •

Copy link
Copy Markdown

ModalDialog exposes an as prop in its public TypeScript interface even though its implementation uses a fixed <div>. Per the maintainer's clarification, that prop was introduced accidentally and should be removed.

Remove as and its TSDoc from ModalDialogProps. The dialog implementation remains the upstream fixed DIV; the earlier proposed polymorphic rendering support has been removed from this PR. Add a type assertion preventing as from being exposed again, alongside coverage for the default root, forwarded ref, classes, content and attributes.

Validation:

  • With the new type assertion and the previous public interface, tsc --project test/tsconfig.json --noEmit fails on the assertion. With as removed, the complete test TypeScript project passes.
  • ModalDialogSpec plus the existing Modal/Body/Header/Footer/Title specs pass in real headless Chromium: 6 files, 50 tests. The type assertion is verified by TypeScript; it is not a runtime failure test.
  • Normal default and modifier fixtures using the actual component source pass in Chromium 151.0.7922.34, Firefox 153.0 and WebKit 26.5: 6 cases before and 6 after, including ref identity, classes, inner content and attributes. Corresponding normal-use screenshots are byte-identical. No page errors, console errors/warnings, or external requests were recorded.
  • Changed-file ESLint/Prettier and git diff --check pass. Existing task dependencies and browser installations were reused. A full repository suite, documentation build and OS screen-reader speech test were not run.

This follows the maintainer's requested direction. The previous custom-element/custom-component demonstration and support tests have been removed because those are not the intended API.

AI-assisted implementation and independent static diff review; all reported checks were executed locally.

@kyletsang

Copy link
Copy Markdown
Member

as prop was accidentally introduced as part of a refactor. It should actually be removed rather than supported here

@netlify

netlify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

👷 Deploy request for react-bootstrap pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit e96baa8
@poplolioi11 poplolioi11 changed the title fix(ModalDialog): honor the existing as prop Nov 11, 2026
@poplolioi11

Copy link
Copy Markdown
Author

Thanks for clarifying the intended API. Updated this PR in cf25372 to remove as and its TSDoc from ModalDialogProps, retaining the fixed DIV implementation. The earlier polymorphic support and its tests have been removed. Added a type regression check: it fails against the previous interface and passes with as removed. The full test TypeScript project, 50 related browser tests, and normal-use controls in Chromium, Firefox and WebKit pass. The title and description now reflect this direction.

Comment thread test/ModalDialogSpec.tsx Outdated
expect(dialog.querySelector('strong')!.textContent).toEqual('Content');
});

it('does not expose an as prop for its fixed dialog root', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this test because it's not useful

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review. I removed the redundant as assertion and its now-unused imports in e96baa8. The remaining targeted browser test, lint check, and test TypeScript typecheck pass locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants