-
Notifications
You must be signed in to change notification settings - Fork 350
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
Add TeX support to dropdown #1810
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (3f8a825) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1810 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1810 |
Size Change: +44 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
This will be ready for review once this update has been released to WB: Khan/wonder-blocks#2354 |
## Summary: When you pass in a JSX Element as a label to `OptionItem`, the SelectOpener is labeled with an empty string. This PR updates SelectOpener in the `SingleSelect` and `MultiSelect` components to return the JSX as a label in that case. This change is being made to unblock supporting TEX in the Perseus Dropdown widget. Issue: LIT-1425 ## Test plan: - Added new stories - https://5e1bf4b385e3fb0020b7073c-xhxyrfwkfd.chromatic.com/?path=/story/packages-dropdown-singleselect--custom-option-item-with-node-label - https://5e1bf4b385e3fb0020b7073c-xhxyrfwkfd.chromatic.com/?path=/story/packages-dropdown-multiselect--custom-option-items-with-node-label - Unit tests pass - Installed npm snapshot and tested against my branch in Perseus ([PR here](Khan/perseus#1810)) - Test in webapp and storybook to ensure no regressions Author: daniellewhyte Reviewers: marcysutton, daniellewhyte, beaesguerra, jandrade Required Reviewers: Approved By: beaesguerra, jandrade Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️ Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ⏭️ dependabot Pull Request URL: #2354
@@ -1,6 +1,6 @@ | |||
import type {PerseusRenderer} from "../../perseus-types"; | |||
|
|||
export const question1: PerseusRenderer = { | |||
export const basicDropdown: PerseusRenderer = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!! Meaningful names are so hard to come by these days.
content={this.props.placeholder} | ||
strings={this.context.strings} | ||
inline | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using <Renderer>
feels heavy for rendering TeX. Perhaps using the <TeX>
component would be a lighter-weight implementation? Access to this component is via getDependencies()
instead of direct import. Can we give that a try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bummer. OK. Let's stick with the <Renderer>
widget for now. Thanks for checking into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark and I chatted in DMs, but I'll circle back here. I suggested the TeX
component, but didn't realize there might be a mixture of standard content and TeX markup. In that case, Renderer
is the correct tool. It handles parsing content and rendering TeX as needed. This is pretty common to use the Renderer
in widgets to render content (even if widgets aren't supported).
@catandthemachines I think you're right that it's a VO+Chrome issue. I am able to recreate the same behavior on the MathJax stories. It doesn't read the square root. ![]() |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1810](#1810) [`e21ead80e`](e21ead8) Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - Update Dropdown widget to support displaying TeX - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1810](#1810) [`e21ead80e`](e21ead8) Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - Update Dropdown widget to support displaying TeX - [#2023](#2023) [`51386d6e0`](51386d6) Thanks [@nishasy](https://github.com/nishasy)! - [SR] Linear graph - add full graph aria label and description - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1810](#1810) [`e21ead80e`](e21ead8) Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - Update Dropdown widget to support displaying TeX ## @khanacademy/[email protected] ### Patch Changes - [#1810](#1810) [`e21ead80e`](e21ead8) Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - Update Dropdown widget to support displaying TeX - Updated dependencies \[[`e21ead80e`](e21ead8), [`51386d6e0`](51386d6)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1810](#1810) [`e21ead80e`](e21ead8) Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - Update Dropdown widget to support displaying TeX - Updated dependencies \[[`e21ead80e`](e21ead8)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected]
Summary:
This PR adds support for showing TeX in the dropdown
Issue: LIT-1425
Test plan:
Inspect new story:
http://localhost:6006/?path=/story/perseus-widgets-dropdown--dropdown-with-math
mathjax-wrapper
-- HTML inspection. SR reads the labels fine in the list box, but I've had mixed results after an option is selected (works on Firefox, but not Safari). This is not unique to TeX content, and there are a couple issues to address it here: LIT-1516 WB-1799