Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
"files" allowlist so only index.js ships in the tarball
.coveralls.yml, .travis.yml
BREAKING CHANGE: The package is now ESM-only. CommonJS consumers must
load it via dynamic import(). No changes to the ExpandToggle API.