Skip to content

WEBDEV-8811: Migrate ia-clearable-text-input into elements - #68

Open
jbuckner wants to merge 2 commits into
WEBDEV-8812-migrate-ia-dropdownfrom
WEBDEV-8811-migrate-clearable-text-input
Open

WEBDEV-8811: Migrate ia-clearable-text-input into elements#68
jbuckner wants to merge 2 commits into
WEBDEV-8812-migrate-ia-dropdownfrom
WEBDEV-8811-migrate-clearable-text-input

Conversation

@jbuckner

@jbuckner jbuckner commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

What

Moves @internetarchive/ia-clearable-text-input into src/elements/ia-clearable-text-input/, the same shape as the ia-dropdown move in #NN, and points ia-dropdown-search-bar at the local copy.

That was elements' last remaining @internetarchive/* dependency, so dependencies is now just @lit/localize, lit, magic-snowflakes, and tslib.

The close icon

Inlined as a Lit svg template in assets/close.ts rather than keeping @internetarchive/icon-close, following the caret icons from the dropdown move.

Worth doing beyond tidiness: icon-close was pinned at ^1.3.4, which resolves its own copy of Lit. The standalone package's own test run logs Multiple versions of Lit loaded, with lit@2.2.7 at the root and lit@2.6.1 nested under icon-close. Dropping the dependency removes that second copy, and it's the same duplication WEBDEV-8389 and WEBDEV-8810 were opened for. Both are moot for elements now.

The rendered result is unchanged, a 40px glyph on a dark #2c2c2c circle with white fill, measured against the original. The one difference is the shadow DOM: a <span class="clear-icon"> wrapping an <svg> instead of an <ia-icon-close> element. Nothing asserted on that element, so no test needed changing for it, but it's a real change for anyone reaching into the shadow root. The background and fill are now themeable via --clear-button-icon-background and --clear-button-icon-color.

Tests

Ported from web-test-runner + @open-wc/testing + sinon to vitest + vi.fn, keeping all ten behaviours.

The a11y audit (await expect(el).shadowDom.to.be.accessible()) relied on chai-a11y-axe, which elements doesn't have. Rather than drop the coverage or add axe to the repo, it became a direct assertion of what that test was really protecting: the label carries the screenReaderLabel text and its for points at the input.

Added one test that didn't exist before, that the clear event carries the value the field held before clearing.

Test plan

  • Full suite green, 197 tests across 13 files, including the 11 here and the 14 ia-dropdown-search-bar tests now resolving the local component.
  • npm run build and npm run ghpages:build clean.
  • Checked the built demo in a browser: the story is picked up by the *-story.ts glob and appears in the nav, typing reveals the clear button, clearing empties the field and re-hides it, and the inlined icon measures 40×40 inside the 48×48 button with border-radius: 50%, #2c2c2c background and white fill.

Note

npm run lint fails on demo/app-root.ts and demo/story-template.test.ts for formatting. Both are unformatted on main already and untouched here, so they're left alone. CI only runs npm run test, which is why it hasn't surfaced.

Brings the component in as src/elements/ia-clearable-text-input/, the same
shape as the ia-dropdown move, and points ia-dropdown-search-bar at the local
copy so the external package can go. That was elements' last remaining
@internetarchive dependency, so there are none left.

The close icon is inlined as a Lit svg template rather than keeping
@internetarchive/icon-close as a dependency, following the caret icons from
the dropdown move. Dropping it also takes a second copy of Lit out of the
tree: icon-close was pinned at ^1.3.4, which resolves its own lit and made
the component's own test run log "Multiple versions of Lit loaded". The
rendered result is unchanged, a 40px glyph on a dark circle, but the shadow
DOM now holds a span and an svg instead of an <ia-icon-close> element.

Tests move from web-test-runner, @open-wc/testing and sinon over to vitest
and vi.fn. The a11y audit that relied on chai-a11y-axe becomes a direct
assertion that the label points at the input, since elements has no axe
setup. Also added a test for the clear event carrying the pre-clear value,
which nothing covered before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWG9C3uwCAtAJUABguZnV9
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-68/

Built to branch ghpages at 2026-07-29 00:19 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

The pull_request trigger was filtered to main, so this PR got no test run at
all, only the preview deploy, because it's stacked on the ia-dropdown branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWG9C3uwCAtAJUABguZnV9
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.97%. Comparing base (7e520d3) to head (cb28876).
⚠️ Report is 1 commits behind head on WEBDEV-8812-migrate-ia-dropdown.

Files with missing lines Patch % Lines
...ia-clearable-text-input/ia-clearable-text-input.ts 92.59% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           WEBDEV-8812-migrate-ia-dropdown      #68      +/-   ##
===================================================================
+ Coverage                            79.55%   79.97%   +0.41%     
===================================================================
  Files                                   19       20       +1     
  Lines                                  817      844      +27     
  Branches                               214      221       +7     
===================================================================
+ Hits                                   650      675      +25     
  Misses                                 110      110              
- Partials                                57       59       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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