Skip to content

fix: typing decimals with a zero following the decimal point in app number fields - #460

Merged
allison-truhlar merged 2 commits into
mainfrom
fix-number-input-decimal-typing
Oct 2, 2026
Merged

allison-truhlar merged 2 commits into
mainfrom
fix-number-input-decimal-typing

Conversation

@allison-truhlar

@allison-truhlar allison-truhlar commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Addresses issue #459.

Number fields on the app launch form reject some decimal values as you type
them. Typing 0.01 into a field ends up as 1: when you reach 0.0, the form
parses it to 0 and redraws the field as 0, which drops the decimal point
before you type the last digit. Values with no zero right after the point,
such as 0.3 and 1.01, aren't affected.

This PR keeps the text you type in the field while it still equals the stored
number, so intermediate states like 0.0 stay on screen. When the stored value
changes some other way, for example when saved parameters are loaded, the
field shows the new value.

What changed

  • frontend/src/components/ui/AppsPage/AppLaunchForm.tsx: ParameterField
    keeps the raw input text for number and integer fields and shows it
    while it parses to the stored value. The form still stores numbers, so
    validation, submission, and relaunch are unchanged.
  • CLAUDE.md and docs/Development.md: the pixi run test-ui examples now
    use -- --. test-ui runs npm run test, and npm takes flags such as
    --ui, --trace, and -g as its own options, so with a single -- they
    never reached Playwright.
  • docs/Development.md: adds instructions for running Playwright UI mode
    on a remote machine by serving it over HTTP and forwarding the port.

Tests

frontend/ui-tests/tests/apps-launch-form.spec.ts mocks an app manifest with
one number parameter, types 0.01 one key at a time, and checks that the
field still shows 0.01. The test fails without the fix: the field shows
1. It's a Playwright test because Vitest's jsdom environment doesn't
reproduce the browser's number-input behavior.

To test

  1. Run pixi run test-ui -- -- tests/apps-launch-form.spec.ts and check that
    it passes.
  2. In the running app, add an app that has a type: number parameter. The
    add-number-param branch of allison-truhlar/fileglancer-demo-app adds a
    --threshold parameter (default 0.05) for this.
  3. Open the launch form, clear the field, and type 0.01. Check that the
    field shows 0.01.
  4. Launch the job and check that its log shows Threshold: 0.01.

@krokicki

The number input was controlled by the parsed value, so typing "0.0" on
the way to "0.01" parsed to 0 and re-rendered the field as "0", making
the value impossible to enter. Keep the raw typed text as a draft and
show it while it still parses to the stored value, so external resets
still take effect.

Add a Playwright test, since jsdom does not reproduce the browser's
number-input behavior.
pixi run test-ui runs "npm run test", and npm consumes flags such as
--ui, --trace, and -g as its own options unless they follow a "--".
The documented single "--" only separates pixi's arguments, so these
flags never reached Playwright. Add the second "--" for npm.

Also explain how to use UI mode from a remote machine by serving it
over HTTP and forwarding the port.
@allison-truhlar allison-truhlar changed the title Fix typing decimals like 0.01 in app number fields fix: typing decimals with a zero following the decimal point in app number fields Oct 2, 2026
@allison-truhlar
allison-truhlar marked this pull request as ready for review October 2, 2026 15:27
Comment thread docs/Development.md

```bash
pixi run test-ui -- --ui --debug
pixi run test-ui -- -- --ui --debug

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like something went wrong here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes - not directly related to this PR, but I was trying to run the test in the Playwright UI mode and it wasn't working. It turned out npm run was swallowing the extra flags. Adding a double -- -- prior to the flags fixed it.

Comment thread docs/Development.md

```bash
pixi run test-ui -- --trace on
pixi run test-ui -- -- --trace on

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And here, etc.

@allison-truhlar
allison-truhlar merged commit 759c24c into main Oct 2, 2026
4 checks passed
@allison-truhlar
allison-truhlar deleted the fix-number-input-decimal-typing branch October 2, 2026 20:48
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.

2 participants