Skip to content

feat: add react-components TabSheet and MasterDetailLayout wrappers - #13033

Merged
web-padawan merged 3 commits into
mainfrom
feat/react-components-layout-wrappers
Oct 8, 2026
Merged

web-padawan merged 3 commits into
mainfrom
feat/react-components-layout-wrappers

Conversation

@web-padawan

@web-padawan web-padawan commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Description

Part of #12855
Depends on #13035

Fourth slice of the vaadin/react-components port. With it, packages/react-components/src holds the same 84 modules as the source repository. The package stays private: true until the pro package lands.

  • Added the TabSheet and MasterDetailLayout wrappers
  • Added the TabSheet and MasterDetailLayout specs
  • Added the TabSheet and TabSheetTab assertions to the type-level test test/typings/api.ts
  • Added the dev pages TabSheet and MasterDetailLayout (with its stylesheet) in a separate commit

Type of change

  • Feature

How to test

  1. Run yarn release:react
  2. Run yarn test:react
  3. All 17 spec files pass in Chromium, and the generator prints no "has no src wrapper" warning
  4. Run yarn start:react
  5. /dev/ lists eight pages, and the TabSheet and MasterDetailLayout pages render

Note

Source commit ported: vaadin/react-components@4dc4850d1ccec7c45e4394d1c9b79599b9dabd69. Expected mechanical differences from the source files: license headers, Prettier and eslint --fix formatting, inline react-hooks/exhaustive-deps suppressions with reasons, import paths. Type-level autofixes: *Element imports as types, _startTransition as a method signature. Two inline exhaustive-deps suppressions in MasterDetailLayout.tsx with the dependency arrays unchanged. @typescript-eslint/no-namespace is turned off for the test scope because MasterDetailLayout.spec.tsx augments JSX.IntrinsicElements. Vitest: 17 files, 94 tests. exports map: 219 keys, identical to the published 25.4.0-alpha1 map.

🤖 Generated with Claude Code

@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from b194b2f to f2acc98 Compare October 8, 2026 07:48
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from b41c389 to 47e2a8f Compare October 8, 2026 07:48
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from f2acc98 to 7782c9d Compare October 8, 2026 07:53
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 47e2a8f to ebf1719 Compare October 8, 2026 07:53
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from 7782c9d to eb9ad04 Compare October 8, 2026 08:03
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from ebf1719 to 4a893bc Compare October 8, 2026 08:03
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from eb9ad04 to b10fe6a Compare October 8, 2026 08:18
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 4a893bc to 68875da Compare October 8, 2026 08:18
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from b10fe6a to 5271cd1 Compare October 8, 2026 08:20
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 68875da to bd1db83 Compare October 8, 2026 08:20
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch from 5271cd1 to 541285f Compare October 8, 2026 08:28
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from bd1db83 to 32320bc Compare October 8, 2026 08:28
@web-padawan
web-padawan force-pushed the feat/react-components-overlay-wrappers branch 2 times, most recently from 27b1c87 to 53d9990 Compare October 8, 2026 10:02
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 32320bc to adf3f82 Compare October 8, 2026 10:11
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from adf3f82 to 51e9da5 Compare October 8, 2026 10:50
@web-padawan
web-padawan changed the base branch from feat/react-components-overlay-wrappers to test/react-components-shared-specs October 8, 2026 10:50
@web-padawan
web-padawan force-pushed the test/react-components-shared-specs branch from 259d4bf to bd8b8a8 Compare October 8, 2026 12:12
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 51e9da5 to 3a187d8 Compare October 8, 2026 12:18
Base automatically changed from test/react-components-shared-specs to main October 8, 2026 12:26
web-padawan and others added 2 commits October 8, 2026 15:27
Part of #12855

Fourth slice of the vaadin/react-components port: the last two
hand-written wrappers, their specs, the SideNav and themed component
specs, the type-level tests without their pro parts, and the package
README and LICENSE. The src listing now matches the source repository.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@web-padawan
web-padawan force-pushed the feat/react-components-layout-wrappers branch from 3a187d8 to bc54fef Compare October 8, 2026 12:28
@web-padawan
web-padawan marked this pull request as ready for review October 8, 2026 12:38

@vaadin-review-bot vaadin-review-bot 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.

Reviewed the changes — left 3 comments.

Finding
⚠️ The cloned outgoing detail is appended to the layout and never removed
🧪 Transition tests stub _startTransition with behavior that differs from the real one
⚠️ Transition completion writes stale children when the detail changes mid-transition

// so the WC's post-animation cleanup won't remove it from the DOM.
const clone = currentDetailsRef.current.cloneNode(true) as HTMLElement;
clone.setAttribute('slot', 'detail-outgoing');
layout.appendChild(clone);

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.

⚠️ The cloned outgoing detail is appended to the layout and never removed

Every replace transition appends one clone that nothing ever removes: the web component's cleanup in __replaceTransition only removes the old detail when its slot is still detail-outgoing, and the wrapper deliberately changes it to detail-hidden.

Two consequences:

  • The DOM grows by a full copy of the detail view (including duplicate ids) per replace.
  • From the second replace onwards, the detail-outgoing slot holds several clones. They become visible together while [transition="replace"] is set, so the outgoing animation shows the oldest clone instead of the view being replaced. Reproducible on the new dev page by pressing Replace twice: the second animation slides out "Detail Setup GitHub Actions to test in Chrome #1".

The clone needs to be removed once _startTransition resolves.

MasterDetailLayout.tsx:109 · correctness

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

layout = document.querySelector('vaadin-master-detail-layout')!;
expect(layout).to.exist;

(layout as any)._startTransition = (transitionType: string, callback: () => void) => {

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.

🧪 Transition tests stub _startTransition with behavior that differs from the real one

The stub invokes the callback and resolves immediately. The real implementation moves the current detail into the detail-outgoing slot before calling the callback and removes it afterwards unless the slot was reassigned. That handoff is the whole point of the replace branch in the wrapper, and no test exercises it — should call recalculateLayout after Lit elements have rendered is the only test on the real implementation and it only covers add.

A replace test against the real _startTransition would have caught the orphan clone.

MasterDetailLayout.spec.tsx:55 · tests

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let's keep existing tests for now and fix it later.

})
.then(() => {
// Animation finished — sync React state to match DOM reality
setCurrentChildren(children);

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.

⚠️ Transition completion writes stale children when the detail changes mid-transition

The layout effect's deps are [state, currentChildren], so a detail change while a transition is running does not re-run it, and the pending .then() still closes over the old children. It then commits the previous view into currentChildren, so the detail renders view A again before the follow-up effect detects the difference and animates A → B a second time.

Trigger: selecting a second item before the first transition's animation finishes.

Inherited from the source repo, and the dependency array is intentionally unchanged, so it may be worth filing upstream rather than fixing here.

MasterDetailLayout.tsx:128 · correctness

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also reported in vaadin/react-components#412.

…est and dev page

The component is stable since #11773, the flag is no longer read.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@web-padawan
web-padawan merged commit b600eba into main Oct 8, 2026
13 checks passed
@web-padawan
web-padawan deleted the feat/react-components-layout-wrappers branch October 8, 2026 13:27
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.4.0-alpha3.

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.

4 participants