mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-19 00:48:08 +01:00
🎙️ a11y: Screen Reader Support for Dynamic Content Updates (#3625)
* WIP: first pass, hooks * wip: isStream arg * feat: first pass, dynamic content updates, screen reader announcements * chore: unrelated, styling redundancy
This commit is contained in:
parent
05696233a9
commit
6655304753
14 changed files with 353 additions and 54 deletions
26
client/src/a11y/MessageBlock.tsx
Normal file
26
client/src/a11y/MessageBlock.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import React from 'react';
|
||||
|
||||
const offScreenStyle: React.CSSProperties = {
|
||||
border: 0,
|
||||
clip: 'rect(0 0 0 0)',
|
||||
height: '1px',
|
||||
margin: '-1px',
|
||||
overflow: 'hidden',
|
||||
whiteSpace: 'nowrap',
|
||||
padding: 0,
|
||||
width: '1px',
|
||||
position: 'absolute',
|
||||
};
|
||||
|
||||
interface MessageBlockProps {
|
||||
message: string;
|
||||
'aria-live': 'polite' | 'assertive';
|
||||
}
|
||||
|
||||
const MessageBlock: React.FC<MessageBlockProps> = ({ message, 'aria-live': ariaLive }) => (
|
||||
<div style={offScreenStyle} role="log" aria-live={ariaLive}>
|
||||
{message}
|
||||
</div>
|
||||
);
|
||||
|
||||
export default MessageBlock;
|
||||
Loading…
Add table
Add a link
Reference in a new issue