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

[Dropdown] Bugfix - Text in dropdown was shifted up after adding TeX support via Renderer #2059

Merged

Conversation

mark-fitzgerald
Copy link
Contributor

@mark-fitzgerald mark-fitzgerald commented Dec 23, 2024

Summary:

With the recent change in how dropdown content is rendered, the use of the <Renderer> component brought along styling that is overly broad and caused text to be enlarged and shifted up. This bugfix adds styling that targets only instances of renderer styling within a dropdown.

Issue: LEMS-2742

Test plan:

  1. Open any article that contains dropdown widgets, like this one in Test Everything.
    (Note: this issue is only present in Articles - exercises are unaffected by this bug)

  2. Dropdown answers and placeholders should appear centered within the border of the dropdown.

Affected UI

Before:

Dropdown - Before

After:

Dropdown - After

Mark Fitzgerald added 2 commits December 23, 2024 12:25
@mark-fitzgerald mark-fitzgerald self-assigned this Dec 23, 2024
Copy link
Contributor

github-actions bot commented Dec 23, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (17da52d) and published it to npm. You
can install it using the tag PR2059.

Example:

yarn add @khanacademy/perseus@PR2059

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR2059

Copy link
Contributor

github-actions bot commented Dec 23, 2024

Size Change: +8 B (0%)

Total Size: 1.28 MB

Filename Size Change
packages/perseus/dist/es/index.js 419 kB +8 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 78 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-editor/dist/es/index.js 688 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 4.95 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

@mark-fitzgerald mark-fitzgerald marked this pull request as ready for review December 23, 2024 21:01
@mark-fitzgerald mark-fitzgerald requested a review from a team December 23, 2024 21:01
@jeremywiebe
Copy link
Collaborator

@catandthemachines or @anakaren-rojas would you mind reviewing this, please?

Copy link
Member

@catandthemachines catandthemachines left a comment

Choose a reason for hiding this comment

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

Approved, just one question on the usage of !important

@@ -414,6 +414,12 @@
padding: 25px 25px 0 0;
}

.perseus-dropdown .perseus-renderer .paragraph {
/* overriding overly specific selectors in .framework-perseus rules */
margin-bottom: 0 !important;
Copy link
Member

Choose a reason for hiding this comment

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

Just checking, are these !important statements necessary? 🥲

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, yes. There is styling that is 5+ selectors that ends up taking priority over the various options that I tried. Using !important here lets me apply styling that is confined to this use case and doesn't have any unintentional side effects (i.e. bleed-outs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just noticed that I should change "overly specific" to "overly broad".

@SonicScrewdriver SonicScrewdriver merged commit 53ba9f5 into main Jan 6, 2025
8 checks passed
@SonicScrewdriver SonicScrewdriver deleted the bugfix/LEMS-2742-dropdown-text-in-articles-shifted-up branch January 6, 2025 21:57
SonicScrewdriver added a commit that referenced this pull request Jan 6, 2025
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]

### Minor Changes

- [#1738](#1738)
[`dbbc82f2d`](dbbc82f)
Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add
scientific notation button / toggle to basic keypad

## @khanacademy/[email protected]

### Minor Changes

- [#1990](#1990)
[`37c642f24`](37c642f)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Allow
keyboards to navigate and interact with images


- [#1738](#1738)
[`dbbc82f2d`](dbbc82f)
Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add
scientific notation button / toggle to basic keypad

### Patch Changes

- [#2061](#2061)
[`d8b2f7eaf`](d8b2f7e)
Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - update
terminology for angle sides


- [#2071](#2071)
[`bac10129b`](bac1012)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - This
patch fixes our Perseus strings to ensure that they are double escaped
for Lingui.


- [#1952](#1952)
[`617377147`](6173771)
Thanks [@benchristel](https://github.com/benchristel)! - Internal: add
and pass more regression tests for PerseusItem parser


- [#2059](#2059)
[`53ba9f5d1`](53ba9f5)
Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! -
[Dropdown] Bugfix - Text in dropdown was shifted up after adding TeX
support via Renderer

- Updated dependencies
\[[`dbbc82f2d`](dbbc82f)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#1738](#1738)
[`dbbc82f2d`](dbbc82f)
Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add
scientific notation button / toggle to basic keypad

### Patch Changes

- Updated dependencies
\[[`d8b2f7eaf`](d8b2f7e),
[`bac10129b`](bac1012),
[`37c642f24`](37c642f),
[`617377147`](6173771),
[`dbbc82f2d`](dbbc82f),
[`53ba9f5d1`](53ba9f5)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

- Updated dependencies
\[[`dbbc82f2d`](dbbc82f)]:
    -   @khanacademy/[email protected]
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.

4 participants