Skip to content

Remove long-outdated "star property hack" #2628

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jeremywiebe
Copy link
Collaborator

@jeremywiebe jeremywiebe commented Jun 20, 2025

Summary:

This PR removes an old CSS hack that are no longer relevant in our codebase (it's for IE7!)

Specifically, I noticed the CSS compiler balking at: *zoom: 1. So I asked the Genie about it and here's the explanation it gave.

The * in *zoom: 1; is a CSS hack called the "star property hack"
or "IE7 hack". It's used to target Internet Explorer 7 specifically.

Here's what it does:

  • The * prefix makes the property only apply to Internet Explorer 7
    and earlier versions.
  • Other browsers ignore properties that start with *.
  • zoom: 1 is a Microsoft-specific CSS property that triggers
    "hasLayout" in IE, which is needed for certain layout behaviors
    to work correctly.

In this case, it's being used as part of a clearfix implementation.
The clearfix is a CSS technique to ensure that a container properly
contains its floated children. The *zoom: 1 ensures that IE7 properly
handles the layout of the clearfix container.

However, this hack is quite outdated since:

  • Internet Explorer 7 was discontinued in 2015
  • Modern browsers have much better CSS support
  • There are cleaner ways to achieve the same layout effects today

The linter error you're seeing is likely because the linter doesn't
recognize the * prefix as valid CSS syntax, which is expected since
it's a browser-specific hack rather than standard CSS.

Issue:

Test plan:

I don't think this is a risky change as it's documented as being ignored by modern browsers and specifically for IE7!

Copy link
Contributor

github-actions bot commented Jun 20, 2025

Size Change: 0 B

Total Size: 472 kB

ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.7 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 98.6 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.js 20.4 kB
packages/perseus-editor/dist/es/index.js 91.1 kB
packages/perseus-linter/dist/es/index.js 7.14 kB
packages/perseus-score/dist/es/index.js 9.23 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 200 kB
packages/perseus/dist/es/strings.js 7.56 kB
packages/pure-markdown/dist/es/index.js 1.22 kB
packages/simple-markdown/dist/es/index.js 6.72 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Jun 20, 2025

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR2628

If you are working in Khan Academy's frontend, you can run the below command.

./tools/bump_perseus_version.js -t PR2628

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -s n -t PR2628

@jeremywiebe jeremywiebe changed the title Remove long-outdated CSS hacks Remove long-outdated "star property hack" Jun 20, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Removes the outdated IE7-specific “star property hack” (*zoom: 1) from two style sheets, since modern browsers no longer require it.

  • Delete legacy clearfix rule in radio.css
  • Delete the same legacy clearfix rule in util.css

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/perseus/src/styles/widgets/radio.css Remove *zoom: 1 rule from the clearfix block
packages/perseus/src/styles/util.css Remove *zoom: 1 rule from the clearfix block
Comments suppressed due to low confidence (2)

packages/perseus/src/styles/widgets/radio.css:11

  • [nitpick] The .perseus-clearfix definition appears in multiple CSS files. Consider centralizing the clearfix rules into a shared utility stylesheet to avoid duplication and ease future updates.
}

packages/perseus/src/styles/widgets/radio.css:11

  • Since this removes a layout-related hack, adding a visual regression test for the affected components (e.g., radio widget containers) can help catch any unintended layout shifts.
}

@jeremywiebe jeremywiebe marked this pull request as ready for review June 20, 2025 17:13
Copy link
Member

@benchristel benchristel left a comment

Choose a reason for hiding this comment

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

Hyrum's Law at its finest 🙈. LGTM.

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.

2 participants