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

[Numeric Input] - Update styling to match modern inputs #1832

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

Conversation

mark-fitzgerald
Copy link
Contributor

@mark-fitzgerald mark-fitzgerald commented Nov 7, 2024

Summary:

The styling of the numeric input widget is quite constrained in regards to its size, and it is difficult to know when it has focus. Increasing its height will make it more physically accessible (better touch target). Adding more internal padding and increasing the border width will help with visual accessibility regarding a user's recognition of it having focus. Also, matching the styling that is used for the Expression widget (a close relative of this widget) lessens the cognitive load on users who see these two inputs as being similar/same (they don't know that they are two different widgets).

Issue: LEMS-2426

Test plan:

  1. Launch Storybook (yarn start)
  2. Navigate to Perseus => Widgets => NumericInput => Question 1
    • Note that the input field is larger
  3. Click or tab into the field
    • Note that the border is thicker and that the cursor is more visible (not next to the border as it was before)

Affected UI:

Standard presentation

Before:

Before - Standard

After:

After - Standard

In-Focus

Before:

Before - Focused

After:

After - Focused

@mark-fitzgerald mark-fitzgerald self-assigned this Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1832

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

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

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Size Change: +211 B (+0.02%)

Total Size: 859 kB

Filename Size Change
packages/perseus/dist/es/index.js 410 kB +211 B (+0.05%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.8 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 77.8 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 283 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.54 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Mark Fitzgerald added 2 commits November 6, 2024 16:47
Adjust spacing.
@mark-fitzgerald mark-fitzgerald marked this pull request as ready for review November 12, 2024 23:18
@khan-actions-bot khan-actions-bot requested a review from a team November 12, 2024 23:19
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/two-turtles-return.md, packages/perseus/src/widgets/numeric-input/numeric-input.tsx, packages/perseus/src/widgets/graded-group-set/__snapshots__/graded-group-set-jipt.test.ts.snap, packages/perseus/src/widgets/graded-group-set/__snapshots__/graded-group-set.test.ts.snap, packages/perseus/src/widgets/group/__snapshots__/group.test.tsx.snap, packages/perseus/src/widgets/numeric-input/__snapshots__/numeric-input.test.ts.snap

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

fontSize: "18px",
height: "32px",
lineHeight: "18px",
padding: this.state.isFocused ? "4px" : "4px 5px", // account for added focus border thickness
textAlign: this.props.rightAlign ? "right" : "left",
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the comments to help explain the difference!

Copy link
Contributor

@SonicScrewdriver SonicScrewdriver left a comment

Choose a reason for hiding this comment

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

This looks wonderful! :) Thank you for the great improvements

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