react-sr-pronounce
A React component that lets you control how content is pronounced by screen-readers. It does this using the ruby
element. The trick is described in an answer to the Stackoverflow question #43491644.
Installation
Install with npm (or yarn).
npm install react-sr-pronounce --save
Usage
import React, { Component } from 'react';
import { HashRouter } from 'react-router-dom';
import SrPronounce from 'react-sr-pronounce';
export default class App extends Component {
render() {
return (
<p>
In this sentence, <SrPronounce as="rècord">record</SrPronounce> is pronounced as a noun.
</p>
);
}
}
Demo
Try out the live example.
Support
Tested with:
- VoiceOver on macOS Sierra 10.12.5 in Chrome
License
MIT. Copyright (c) 2017 Jonathan Conway.