Skip to content

Modernize tooling, drop build pipeline, bugfixes#53

Merged
tedw merged 21 commits into
masterfrom
v4
May 18, 2026
Merged

Modernize tooling, drop build pipeline, bugfixes#53
tedw merged 21 commits into
masterfrom
v4

Conversation

@tedw

@tedw tedw commented May 18, 2026

Copy link
Copy Markdown
Member

Replace the webpack/babel/jest/eslint stack with native ESM and Node's
built-in test runner. The package now ships index.js directly as an ES
module; consumers' bundlers (or Node) handle it without transpilation.

  • Switch package.json to "type": "module" with an "exports" map and a
    "files" allowlist so only index.js ships in the tarball
  • Replace Jest with node:test + node:assert against happy-dom
  • Replace Travis CI with a GitHub Actions workflow on Node 20 and 22
  • Drop dist/, docs/, webpack.config.js, .babelrc, .eslintrc.json,
    .coveralls.yml, .travis.yml
  • Reduce devDependencies from 15 packages to 1 (happy-dom)

BREAKING CHANGE: The package is now ESM-only. CommonJS consumers must
load it via dynamic import(). No changes to the ExpandToggle API.

tedw and others added 21 commits May 18, 2026 11:13
Replace the webpack/babel/jest/eslint stack with native ESM and Node's
built-in test runner. The package now ships index.js directly as an ES
module; consumers' bundlers (or Node) handle it without transpilation.

- Switch package.json to "type": "module" with an "exports" map and a
  "files" allowlist so only index.js ships in the tarball
- Replace Jest with node:test + node:assert against happy-dom
- Replace Travis CI with a GitHub Actions workflow on Node 20 and 22
- Drop dist/, docs/, webpack.config.js, .babelrc, .eslintrc.json,
  .coveralls.yml, .travis.yml
- Reduce devDependencies from 15 packages to 1 (happy-dom)

BREAKING CHANGE: The package is now ESM-only. CommonJS consumers must
load it via dynamic import(). No changes to the ExpandToggle API.
Remove the misplaced 'use client' directive (a Next.js RSC marker) and
replace the JSDoc description that was copied in from a different
package.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previously the constructor read targetEl.parentNode (assigning an unused
targetParentEl field) before checking if targetEl resolved, so an
unmatched data-expands id threw TypeError instead of warning. Drop the
unused field and let the existing null check do its job.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
shouldStartExpanded only updated aria attributes, leaving the toggle in
an inconsistent state when classes or active text were configured.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…empotent

Repeated expand() or collapse() calls now return early and only fire
their event on a real state transition. toggle() reads the internal
flag instead of round-tripping through the DOM attribute.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Respect both the native disabled property and aria-disabled="true" so
that programmatic clicks on a disabled toggle do not change state.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Allow toggle() to be called programmatically without an event by
optional-chaining preventDefault(). expand() and collapse() already
only forward the event to their emitted events, so they were already
safe to call without one.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Capture and swap only the first text-node child instead of replacing
the entire textContent. Sibling children such as icon SVGs are now
retained across expand/collapse/destroy.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Recommend against mixing icons inside the text element, and note that
when they are mixed only the first text node is swapped.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Avoid recomputing tagName.toLowerCase() in init() and destroy().

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Modern screen readers handle aria-controls correctly; the 2018 reason
for omitting it (NVDA double-announcing) no longer applies. The target
id is already known, so this is a one-line addition that improves
assistive-tech navigation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
aria-haspopup is appropriate only for menu/dialog/listbox/tree/grid
widgets; the WAI-ARIA Disclosure pattern does not use it. Default to
omitting the attribute, and let consumers opt in with the new
ariaHasPopup option or data-expands-haspopup attribute (boolean or an
ARIA 1.1 value).

BREAKING CHANGE: aria-haspopup="true" is no longer emitted by default.
Consumers relying on it must set ariaHasPopup: true (or a specific
ARIA 1.1 value) in their options or via data-expands-haspopup.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The WAI-ARIA Disclosure pattern reserves arrow keys for menus,
listboxes, and similar widgets; using them for a generic
expand/collapse conflicts with assistive-technology expectations.
<button> elements activate natively on Enter and Space, so removing
the custom keyboard handler simplifies the component without losing
keyboard support for the common case.

BREAKING CHANGE: Down/Up/Escape no longer expand or collapse the
component. If menu-style keyboard behavior is needed, attach it
outside this library.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The flag was set in init() and destroy() but never read; its original
guard for a resize handler was removed long ago.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Always normalize expandedClasses to an array via split(/\s+/).filter(Boolean)
instead of branching on single-vs-multi-class strings. Use object spread
for options merging in place of Object.assign.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add a Sass mixin that produces the required expand/collapse styles,
including prefers-reduced-motion support and a .no-js fallback for
progressive enhancement of navigation menus. Expose it at the package
root via the "sass" field and a subpath export so consumers can
@use "@threespot/expand-toggle/expandable".

README now leads with the mixin example in place of the raw CSS.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@tedw tedw merged commit 570d520 into master May 18, 2026
2 checks passed
@tedw tedw deleted the v4 branch May 19, 2026 13:37
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.

1 participant