@zohodesk/a11y
Version:
In this Package, We Provide Some Basic Components For Accessibility.
89 lines (68 loc) • 1.96 kB
Markdown
To integrate the Reading Mask feature into your project, install the necessary package using npm:
```sh
npm install @zohodesk/a11y
```
After installation, import the `ReadingMask` component into your project:
```javascript
import { ReadingMask } from '@zohodesk/a11y';
```
Customize the `ReadingMask` component using the `uiConfig` object.
```javascript
const uiConfig = {
dimensions: {
height: 25,
width: 100,
},
appearance: {
opacity: 1,
},
getRootElement : () => {}
};
```
Implement the `ReadingMask` component in your application and pass the `uiConfig` as a prop.
`getRootElement` is Required , here this function refered as a target container element.
```javascript
function App() {
return (
<div>
<ReadingMask uiConfig={uiConfig} />
</div>
);
}
export default App;
```
```javascript
import { ReadingMaskEventManager } from '@zohodesk/a11y'
const readingMaskEventManager = new ReadingMaskEventManager();
function IFrameOnMount() {
readingMaskEventManager.addMouseMoveListener(iframeElement)
}
function IFrameOnUnMount() {
readingMaskEventManager.removeMouseMoveListener(iframeElement)
}
```
Ensure type safety by defining prop types for `ReadingMask`:
```javascript
import PropTypes from 'prop-types';
ReadingMask.propTypes = {
uiConfig: PropTypes.shape({
dimensions: PropTypes.shape({
height: PropTypes.number,
width: PropTypes.number,
}),
appearance: PropTypes.shape({
opacity: PropTypes.number,
}),
getRootElement : PropTypes.node.function
}),
};
```
By following these steps, you can successfully integrate the Reading Mask into your application, enhancing accessibility and user experience. Adjust the configuration options as needed to fit your specific requirements.