Skip to content

Feature branch pull-request from feature/floating-ui to main#2832

Draft
jandrade wants to merge 22 commits intomainfrom
feature/floating-ui
Draft

Feature branch pull-request from feature/floating-ui to main#2832
jandrade wants to merge 22 commits intomainfrom
feature/floating-ui

Conversation

@jandrade
Copy link
Copy Markdown
Member

Summary:

This PR includes the following commits:

Issue: WB-1680

Test plan:

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: a06997c

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

This PR includes changesets to release 2 packages
Name Type
@khanacademy/wonder-blocks-floating Minor
@khanacademy/wonder-blocks-popover 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 24, 2025

Size Change: +2.95 kB (+2.69%)

Total Size: 113 kB

Filename Size Change
packages/wonder-blocks-floating/dist/es/index.js 2.78 kB +2.78 kB (new file) 🆕
packages/wonder-blocks-popover/dist/es/index.js 4.5 kB +176 B (+4.07%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3 kB
packages/wonder-blocks-announcer/dist/es/index.js 1.74 kB
packages/wonder-blocks-badge/dist/es/index.js 2.02 kB
packages/wonder-blocks-banner/dist/es/index.js 2.01 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.92 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 755 B
packages/wonder-blocks-button/dist/es/index.js 4.25 kB
packages/wonder-blocks-card/dist/es/index.js 1.08 kB
packages/wonder-blocks-cell/dist/es/index.js 2.18 kB
packages/wonder-blocks-clickable/dist/es/index.js 2.6 kB
packages/wonder-blocks-core/dist/es/index.js 2.48 kB
packages/wonder-blocks-data/dist/es/index.js 5.48 kB
packages/wonder-blocks-dropdown/dist/es/index.js 19.5 kB
packages/wonder-blocks-form/dist/es/index.js 6.3 kB
packages/wonder-blocks-grid/dist/es/index.js 1.24 kB
packages/wonder-blocks-icon-button/dist/es/index.js 4 kB
packages/wonder-blocks-icon/dist/es/index.js 1.91 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 3.48 kB
packages/wonder-blocks-layout/dist/es/index.js 1.63 kB
packages/wonder-blocks-link/dist/es/index.js 1.54 kB
packages/wonder-blocks-modal/dist/es/index.js 7.14 kB
packages/wonder-blocks-pill/dist/es/index.js 1.31 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.48 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.1 kB
packages/wonder-blocks-styles/dist/es/index.js 464 B
packages/wonder-blocks-switch/dist/es/index.js 1.55 kB
packages/wonder-blocks-tabs/dist/es/index.js 3.8 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.25 kB
packages/wonder-blocks-testing/dist/es/index.js 978 B
packages/wonder-blocks-theming/dist/es/index.js 384 B
packages/wonder-blocks-timing/dist/es/index.js 1.37 kB
packages/wonder-blocks-tokens/dist/es/index.js 5.01 kB
packages/wonder-blocks-toolbar/dist/es/index.js 906 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.02 kB
packages/wonder-blocks-typography/dist/es/index.js 1.57 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 24, 2025

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-qvsijgockb.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 15
Tests with visual changes 0
Total stories 775
Inherited (not captured) snapshots [TurboSnap] 442
Tests on the build 457

jandrade and others added 9 commits October 28, 2025 11:16
## Summary:

- Adds `@floating-ui/react` dependency to the project.
- Adds Floating folder structure and initial Floating component.

**NOTE:** The next PR will include the base version of the `Floating` component. I'll be making more adjustments to that component as soon as I start converting existing Popper cases to use this component.

Issue: https://khanacademy.atlassian.net/browse/WB-2111

## Test plan:

Verify that all checks pass.

Author: jandrade

Reviewers: beaesguerra, jandrade

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 12 checks were successful, ⏭️  2 checks have been skipped

Pull Request URL: #2835
## Summary:

This PR introduces the Floating component to Wonder Blocks. This is the first
version of the component with basic properties and middleware support.

Also included the Storybook documentation and snapshot tests for the component.

<img width="864" height="493" alt="Screenshot 2025-10-29 at 10 20 14 AM" src="https://github.com/user-attachments/assets/3aa899fe-d039-434d-ae7b-c13e31c2ae60" />


**NOTE:** Next PRs will add more features and props to the Floating component.

Issue: https://khanacademy.atlassian.net/browse/WB-2111

## Test plan:

- Verify that the docs look correct in Storybook: `/?path=/docs/packages-floating-floating--docs`

- Also verify that the snapshot tests look good: `/?path=/story/packages-floating-testing-snapshots-floating--scenarios`

Author: jandrade

Reviewers: beaesguerra, jandrade

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 12 checks were successful, ⏭️  2 checks have been skipped

Pull Request URL: #2842
## Summary:

Next step on the Floating component:

- Adds portal prop and copies maybeGetPortalMountedModalHostElement from WB
Modal.

### Implementation plan:

1. #2835
2. #2842
3. Add portal prop to Floating component (this PR)
4. Add focus management
5. Add `style` prop and RTL support


Issue: https://khanacademy.atlassian.net/browse/WB-2111

## Test plan:

Navigate to the Floating component stories and verify that the portal example
works as expected. This means that the floating content should be rendered
inside the modal host element.

Also verify that this looks and works good in the Floating Testing Snapshots
story.

Author: jandrade

Reviewers: jandrade, somewhatabstract, beaesguerra, marcysutton

Required Reviewers:

Approved By: somewhatabstract, beaesguerra

Checks: ✅ 12 checks were successful, ⏭️  2 checks have been skipped

Pull Request URL: #2844
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 20, 2025

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (eb0425d) and published all packages with changesets to npm.

You can install the packages in frontend by running:

./dev/tools/deploy_wonder_blocks.js --tag="PR2832"

Packages can also be installed manually by running:

pnpm add @khanacademy/wonder-blocks-<package-name>@PR2832

jandrade and others added 12 commits November 25, 2025 14:49
## Summary:

- Adds focus management support to Wonder Blocks Floating

Implementation plan:

- #2835
- #2842
- #2844
- Add focus management (this PR)
- Add style prop and RTL support

Issue: WB-2111

## Test plan:

Navigate to the Floating component stories and verify that the focus management
works as expected in the "Focus Manager" section.

Author: jandrade

Reviewers: beaesguerra, jandrade, marcysutton

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 12 checks were successful, ⏭️  3 checks have been skipped

Pull Request URL: #2846
## Summary:

Next floating PR that adds the `styles` prop to customize the look and feel of
the floating element.

Note that this slightly differs from the implementation spec as we use SVG for
the arrow element, so we expose different keys in the `styles.arrow` object.


Issue: WB-2111

## Test plan:

Navigate to `/?path=/docs/packages-floating--docs&globals=direction:ltr#custom-styles`.

Verify that the docs are correct and the styles are looking as expected.

Also verify that the "Custom styles" case is added to the scenarios snapshot.

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 11 checks were successful, ⏭️  4 checks have been skipped

Pull Request URL: #2880
## Summary:

Adds right-to-left support to Floating component.

To support this, I've created a custom middleware to be able to mirror the
floating placement in RTL contexts.

Issue: https://khanacademy.atlassian.net/browse/WB-2162

## Test plan:

Navigate to any floating stories, select the `RTL` mode, and verify that the
floating element flips when the `placement` is `left*` or `right*`.

Author: jandrade

Reviewers: marcysutton, beaesguerra, jandrade

Required Reviewers:

Approved By: marcysutton, beaesguerra

Checks: ✅ 11 checks were successful, ⏭️  4 checks have been skipped

Pull Request URL: #2881
## Summary:

Updated some Floating stories that don't require focus manager to be enabled, so
that it doesn't cause a11y issues.

Also made some changes to the `Middlewares` story to ensure that the floating element
is correctly positioned within the scrolling container.

Issue: "none"

## Test plan:

Navigate to `/?path=/docs/packages-floating--docs` and verify that the stories
render correctly.

Author: jandrade

Reviewers: beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ⏭️  3 checks have been skipped, ✅ 13 checks were successful

Pull Request URL: #2922
…rdRef (#2914)

## Summary:

This PR starts the work to refactor the `Popover` component to use the
`Floating` component.

It does the following:
- Refactor the `Popover` and `PopoverAnchor` components to function components
- Add forwardRef to the `PopoverAnchor` component
- Modifies the `PopoverAnchor` component to pass the forwardRef while allowing
to pass a custom ref to the anchor element.

Issue: WB-2119

## Test plan:

Verify that the snapshots and stories are working as expected.

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 13 checks were successful, ⏭️  3 checks have been skipped

Pull Request URL: #2914
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.

1 participant