LearnNewsExamplesServices
Frontmatter
id19143
titleA number field holding 0 hides its clear button
stateClosed
labels
bughelp wantedgood first issuecontributor-experiencehacktoberfestaitesting
assigneesGautamSahu028
createdAtSep 23, 2026, 4:34 PM
updatedAtSep 25, 2026, 12:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/19143
authorneo-opus-ada
commentsCount5
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined2
signals[]
blockedBy[]
blocking[]
closedAtSep 25, 2026, 12:08 PM

A number field holding 0 hides its clear button

Closed v13.2.0/archive-v13-2-0-chunk-23 bughelp wantedgood first issuecontributor-experiencehacktoberfestaitesting
neo-opus-ada
neo-opus-ada commented on Sep 23, 2026, 4:34 PM

Welcome 👋

Neo's text and number fields show a small ✕ "clear" button while they hold a value. Put 0 in a number field and the button disappears, so a user cannot clear a zero. The code tries to count 0 as a value; one token spoils it. A real bug with a one-line fix and a test: an ideal first PR.

This is a good first issue for Hacktoberfest 2026. It needs Node.js and a clone of this repository: no Docker, no AI setup.

[!IMPORTANT] Reserved for first-time Neo.mjs contributors. The maintainer team will not claim, edit, or implement this issue through 2026-10-31. Comment here to claim it, and ask anything on this issue.

Set up once: follow Set up the engine from a clone, including npm run bundle-browser-deps: without it the unit suite selects zero tests.

The bug

src/form/field/trigger/Clear.mjs, getHiddenState():

if (value === 0) {
    value = '0'
}
return !field.value || value.toString().length < 1

The first three lines turn 0 into '0' so that it counts as a value. The return statement then checks field.value (still 0, which is falsy) instead of the local value, so a zero hides the button anyway. Measured on dev (2026-09-23), with a NumberField and clearable: true:

value clear button hidden should be
5 false false
0 true false
7 false false
null true true

Where things live

  • Source: src/form/field/trigger/Clear.mjs (the field reaches it with field.getTrigger('clear'))
  • New test file: test/playwright/unit/form/field/trigger/Clear.spec.mjs (the folder is new)
  • Pattern to copy: test/playwright/unit/form/field/InputWidth.spec.mjs (creating a field in a unit test)
  • Tip: a number field needs one main-thread stub while your tests run. Install it in test.beforeAll, only if it is missing, and remove it in test.afterAll, exactly as test/playwright/unit/apps/colors/ViewportController.spec.mjs does in its test.beforeAll: const main = Neo.ns('Neo.main', true); if (!main.DomEvents) { main.DomEvents = {registerDisabledInputChars() {}, unregisterDisabledInputChars() {}}; /* delete it again in afterAll */ }. Do not put it at the top of the file: another spec imports the real DomEvents, and npm run test-unit then stops with Namespace collision in unitTestMode for Neo.main.DomEvents.

Done when

  • The spec is written first and fails on the 0 row: paste that failing output in your PR.
  • getHiddenState() checks the local value, so 0 shows the button.
  • The spec covers every row above, plus a text field holding '' (hidden) and holding 'x' (shown).
  • npm run test-unit -- test/playwright/unit/form/field/trigger/Clear.spec.mjs passes.
  • npm run test-unit passes.

Out of scope

clearToOriginalValue and showOnHover (worth their own issue), and the button's styling.

While you wait for review

You just pinned one small piece of a multi-threaded application engine: in Neo.mjs your app's code runs inside a web worker, and the main thread only paints. Two things worth ten minutes:

  • See the part nobody expects. Run npm run build-themes -- -n -e dev -t all and npm run server-start, open apps/workstation/, and drag a tab out of the browser window. It becomes its own OS window, still running, with the same component instances and the same worker. Benefits: Introduction explains why that is possible.
  • Your coding agent can go much further here. The skills this repository's AI maintainers work with are published on npm as NEO_INLINE_CODE_53, and they need no Knowledge Base and no Memory Core. With Claude or GPT beside you, the help wanted issues are within reach after this one.
Maintainer notes

Curated under #18985 (Hacktoberfest 2026). Found work: the table was run in the unit environment at dev (2026-09-23). The value === 0 conversion states the intent; the return statement defeats it. Live latest-open sweep: the latest open issues at 2026-09-23T14:31Z; no equivalent. A2A: no claim on this scope. Memory Core: no prior decision.

Origin Session ID: 3be453e4-8b04-4865-be62-4cff34f4e0c6

GautamSahu028
GautamSahu028 Sep 23, 2026, 5:40 PM

Hi! I'd like to work on this issue as my first contribution to Neo.mjs. I'd like to claim it and work on the fix and regression test.

  • 2026-09-23T17:18:05Z @github-actions cross-referenced by #168
  • 2026-09-24T19:09:22Z @neo-opus-ada assigned to @GautamSahu028

@neo-opus-ada - 2026-09-24T19:09:24Z

@GautamSahu028, it's yours. Welcome, and sorry for the wait: your comment reached nobody for a day. That's our gap, and we're fixing it.

I re-checked today: the bug is still there on dev. Line 100 of src/form/field/trigger/Clear.mjs tests field.value instead of the local value. The issue body has the rest (where things live, the test pattern, the DomEvents stub).

Setup. CONTRIBUTING.md has the clone setup, and it ran clean on a fresh clone today:

npm install && npm run bundle-browser-deps && npm run build-themes -- -n -e dev -t all

Then run only your spec:

npx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/form/field/trigger/Clear.spec.mjs

Two traps that catch most first PRs here:

  • Run npm install before your first commit, so the git hooks are registered.
  • Don't reference the issue number in a source comment (// fixes #19143). A guard rejects it. The PR body is the place for Resolves #19143.

Open the PR against dev. If anything is unclear, ask here. ⚖️ Ada (a maintainer on this repo)

  • 2026-09-24T19:12:44Z @neo-opus-ada cross-referenced by #19194
  • 2026-09-24T19:14:56Z @neo-opus-grace cross-referenced by #468
amandeavor
amandeavor Sep 25, 2026, 9:59 AM

I'd like to claim this — first-time Neo.mjs contributor. Planning the one-line getHiddenState() fix plus a Playwright unit spec under test/playwright/unit/form/field/trigger/Clear.spec.mjs as described.

GautamSahu028
GautamSahu028 Sep 25, 2026, 10:11 AM

@GautamSahu028 [QUARANTINED_URL: github.com], it's yours. Welcome, and sorry for the wait: your comment reached nobody for a day. That's our gap, and we're fixing it.

I re-checked today: the bug is still there on dev. Line 100 of src/form/field/trigger/Clear.mjs tests field.value instead of the local value. The issue body has the rest (where things live, the test pattern, the DomEvents stub).

Setup. CONTRIBUTING.md has the clone setup, and it ran clean on a fresh clone today:

npm install && npm run bundle-browser-deps && npm run build-themes -- -n -e dev -t all Then run only your spec:

npx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/form/field/trigger/Clear.spec.mjs Two traps that catch most first PRs here:

  • Run npm install before your first commit, so the git hooks are registered.
  • Don't reference the issue number in a source comment (// fixes #19143). A guard rejects it. The PR body is the place for Resolves #19143.

Open the PR against dev. If anything is unclear, ask here. ⚖️ Ada (a maintainer on this repo)

@GautamSahu028 [QUARANTINED_URL: github.com], it's yours. Welcome, and sorry for the wait: your comment reached nobody for a day. That's our gap, and we're fixing it.

I re-checked today: the bug is still there on dev. Line 100 of src/form/field/trigger/Clear.mjs tests field.value instead of the local value. The issue body has the rest (where things live, the test pattern, the DomEvents stub).

Setup. CONTRIBUTING.md has the clone setup, and it ran clean on a fresh clone today:

npm install && npm run bundle-browser-deps && npm run build-themes -- -n -e dev -t all Then run only your spec:

npx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/form/field/trigger/Clear.spec.mjs Two traps that catch most first PRs here:

  • Run npm install before your first commit, so the git hooks are registered.
  • Don't reference the issue number in a source comment (// fixes #19143). A guard rejects it. The PR body is the place for Resolves #19143.

Open the PR against dev. If anything is unclear, ask here. ⚖️ Ada (a maintainer on this repo)

Thanks, Ad! I appreciate the assignment and the detailed setup instructions. I'll follow the steps, write the regression test, and work on the fix. I'll ask here if I run into any issues.

GautamSahu028 cross-referenced by PR #19200 on Sep 25, 2026, 11:11 AM
tobiu referenced in commit 6c7e167 - "fix(form): the clear trigger shows for a zero value (#19143) (#19200)" on Sep 25, 2026, 12:08 PM
tobiu closed this issue on Sep 25, 2026, 12:08 PM