Skip to content

RFC: Remove Polyfill Support from react-speech-recognition #246

@smorimoto

Description

@smorimoto

Introduction

The react-speech-recognition library currently provides polyfill support for several speech recognition services such as Microsoft Azure Cognitive Services. With the emergence of remarkably accurate and performant speech-to-text (STT) services like ElevenLabs' Scribe, this RFC proposes removing all polyfill support to minimise the package and refocus its purpose.

Proposed Changes

This RFC proposes modifying react-speech-recognition to:

  • Remove all polyfill support completely
  • Focus solely on providing React hooks and components that handle the Web Speech API lifecycle

Reason

The primary value of react-speech-recognition is not in providing alternatives to the Web Speech API, but rather in its management of:

  • Recognition lifecycle within React components
  • Proper cleanup when components unmount
  • State management for recognition results
  • Browser compatibility detection

By focusing exclusively on these aspects, the library can reduce its footprint, simplify maintenance, and provide a clearer API.

Implementation Details

The implementation would involve:

  1. Removing all polyfill-related code and dependencies
  2. Simplifying the API to focus on Web Speech API integration
  3. Updating documentation to reflect the new focus

Advantages

  1. Smaller package size: Significantly reduced bundle size without polyfill code
  2. Simplified maintenance: Focus on one API rather than multiple services
  3. Clearer responsibility boundaries: Specialise in React integration with Web Speech API
  4. Flexibility for developers: Freedom to choose and integrate preferred STT services
  5. Future-proofing: Independence from needing updates for new STT services

Potential Concerns

  1. Breaking changes: Existing implementations using polyfills would need updating
  2. Learning curve: Developers would need to learn third-party service integration 3. Fragmentation: Different projects might implement integrations differently

Conclusion

By focusing exclusively on providing an excellent React wrapper for the Web Speech API, react-speech-recognition can become a more maintainable, leaner library that does one thing exceptionally well. This approach aligns with the React community's preference for smaller, focused libraries over larger all-in-one solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions