Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert popover bug fix #2447

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Revert popover bug fix #2447

merged 2 commits into from
Jan 30, 2025

Conversation

nedredmond
Copy link
Contributor

@nedredmond nedredmond commented Jan 29, 2025

Not only does the fix not meet the intended use case (allowing roving tabindex), it creates additional problems for other consumers with multiple roving tabindexes within their popovers.

Since the method to update the tabindexes doesn't use refs, it has stale tabindex data and will override any dynamically-set tabindex with its original index. In the case of a roving tabindex implementation, that's -1. Therefore, we are trading everything being tabindex=0 for tabindex=-1.

That works fine for the doodlepad controls use case since it has one focus trap and the focus manager will programmatically focus the first element when tabbing from the anchor. From there, event listeners handle the focus fine, but the tabindex never changes to 0 so the position isn't retained.

Unfortunately, the Perseus keypad has two areas that want a roving tabindex. Focus first goes to the close button, and there is no way to get into the roving tabindex areas since they all have -1s. Even if we programmatically focus into the first area by listening to Tab key presses, we'd then have to programmatically focus into the second area.

So there is a heavy burden on Perseus, and even the intended behavior is still partially broken.

The best path forward without any additional adjustments by consumers is to wait for a WB Popover that doesn't hack its childrens' focus.

… need it to do, and would require further adjustments or changes to Perseus widgets. Better to just wait for an updated implementation.
Copy link

changeset-bot bot commented Jan 29, 2025

🦋 Changeset detected

Latest commit: 0b526d9

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

This PR includes changesets to release 1 package
Name Type
@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

@khan-actions-bot khan-actions-bot requested a review from a team January 29, 2025 21:38
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/slow-kings-march.md, packages/wonder-blocks-popover/src/components/focus-manager.tsx, packages/wonder-blocks-popover/src/components/__tests__/focus-manager.test.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Contributor

github-actions bot commented Jan 29, 2025

npm Snapshot: Published

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

You can install the packages in webapp by running:

./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2447"

Packages can also be installed manually by running:

yarn add @khanacademy/wonder-blocks-<package-name>@PR2447

@nedredmond nedredmond requested a review from jandrade January 29, 2025 21:39
Copy link
Contributor

Size Change: -27 B (-0.03%)

Total Size: 98.2 kB

Filename Size Change
packages/wonder-blocks-popover/dist/es/index.js 4.85 kB -27 B (-0.55%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.77 kB
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.77 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 887 B
packages/wonder-blocks-button/dist/es/index.js 4.31 kB
packages/wonder-blocks-cell/dist/es/index.js 2.01 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.06 kB
packages/wonder-blocks-core/dist/es/index.js 2.9 kB
packages/wonder-blocks-data/dist/es/index.js 6.24 kB
packages/wonder-blocks-dropdown/dist/es/index.js 18.9 kB
packages/wonder-blocks-form/dist/es/index.js 5.99 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-icon-button/dist/es/index.js 2.95 kB
packages/wonder-blocks-icon/dist/es/index.js 871 B
packages/wonder-blocks-labeled-field/dist/es/index.js 1.84 kB
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 2.28 kB
packages/wonder-blocks-modal/dist/es/index.js 5.42 kB
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.52 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.34 kB
packages/wonder-blocks-switch/dist/es/index.js 1.92 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.74 kB
packages/wonder-blocks-testing/dist/es/index.js 1.07 kB
packages/wonder-blocks-theming/dist/es/index.js 693 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 2.54 kB
packages/wonder-blocks-toolbar/dist/es/index.js 905 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.99 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

Copy link
Contributor

A new build was pushed to Chromatic! 🚀

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

Chromatic results:

Metric Total
Captured snapshots 332
Tests with visual changes 0
Total stories 530
Inherited (not captured) snapshots [TurboSnap] 48
Tests on the build 380

@nedredmond nedredmond merged commit 03bd4c5 into main Jan 30, 2025
19 of 25 checks passed
@nedredmond nedredmond deleted the ned/revert-popover-fix branch January 30, 2025 16:09
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (8cfaeab) to head (0b526d9).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@     Coverage Diff      @@
##   main   #2447   +/-   ##
============================
============================

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cfaeab...0b526d9. Read the comment docs.

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.

3 participants