Migration v0.3.1 → v0.3.2
Patch release. No breaking changes. ARIA compliance, reliability fixes, new tests, and CI E2E pipeline.
ARIA: aria-selected on Highlighted Options
The connect() function now returns aria-selected on the highlighted option in getItemProps(). This is required by VoiceOver on Chrome — without it, screen readers don't announce which suggestion is highlighted.
No action needed if you use the built-in components. If you use the headless hook, ensure you spread getItemProps(index) onto your list items:
<li {...getItemProps(index)}>
{item.label}
</li> Insertion Failure Now Surfaces via onError
Previously, if a mention insertion failed (e.g., cursor moved between selection and DOM insertion), the failure was silent — the user saw nothing happen with no feedback.
Now, when performMentionInsertion fails, the onError callback fires with a descriptive error message. Handle it to show a toast or retry:
<Mentions
triggers={triggers}
onError={(error) => {
console.warn(error.message);
// "Mention insertion failed: could not insert "Alice" at current cursor position"
}}
/> React: Removed contentEditable Type Cast
The as unknown as boolean workaround for contentEditable="plaintext-only" has been removed. React's type definitions now include "plaintext-only" as a valid value (fixed in @types/react via DefinitelyTyped#67250).
No action needed — this only affects the library's internals.
React: Context Value Memoized
The MentionsContext.Provider value is now wrapped in useMemo with granular dependencies on individual state fields. This prevents unnecessary re-renders of compound components when unrelated state changes.
Vue: useId() Replaces Global Counter
Instance IDs now use Vue's built-in useId() (Vue 3.5+) instead of a module-scoped counter. This is SSR-safe and avoids hydration mismatches.
Vue: RAF Cleanup on Unmount
Pending requestAnimationFrame callbacks for composition handling and initial HTML sync are now properly cancelled in onScopeDispose. Previously, unmounting during an animation frame could trigger a stale callback.
New Tests
Added 90 new unit tests:
connect.test.ts— 39 tests covering ARIA props generation for all statesdom.test.ts— 51 tests covering HTML escaping, DOM walking, mention HTML building
Total unit test count: 198 tests across 7 test files.
CI: E2E Tests in Pipeline
Playwright E2E tests (React + Vue) now run in GitHub Actions on every push and PR. The pipeline runs lint, build, and unit tests first, then E2E with Chromium.