mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #3367 from overleaf/ho-ms-jel-chat-a11y
Improve chat accessibility GitOrigin-RevId: 853da57460c7e3a18abbe1130553e34bd661b6b3
This commit is contained in:
@@ -15,6 +15,7 @@ function ChatPane({
|
|||||||
sendMessage,
|
sendMessage,
|
||||||
userId
|
userId
|
||||||
}) {
|
}) {
|
||||||
|
const { t } = useTranslation()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadMoreMessages()
|
loadMoreMessages()
|
||||||
}, [])
|
}, [])
|
||||||
@@ -36,6 +37,7 @@ function ChatPane({
|
|||||||
itemCount={messageContentCount}
|
itemCount={messageContentCount}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
|
<h2 className="sr-only">{t('chat')}</h2>
|
||||||
{loading && <LoadingSpinner />}
|
{loading && <LoadingSpinner />}
|
||||||
{shouldDisplayPlaceholder && <Placeholder />}
|
{shouldDisplayPlaceholder && <Placeholder />}
|
||||||
<MessageList
|
<MessageList
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ function MessageInput({ resetUnreadMessages, sendMessage }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="new-message">
|
<div className="new-message">
|
||||||
|
<label htmlFor="chat-input" className="sr-only">
|
||||||
|
{t('your_message')}
|
||||||
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
|
id="chat-input"
|
||||||
placeholder={`${t('your_message')}…`}
|
placeholder={`${t('your_message')}…`}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
onClick={resetUnreadMessages}
|
onClick={resetUnreadMessages}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ describe('<MessageInput />', function() {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
screen.getByPlaceholderText('Your Message…')
|
screen.getByLabelText('Your Message')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sends a message after typing and hitting enter', function() {
|
it('sends a message after typing and hitting enter', function() {
|
||||||
@@ -32,7 +32,7 @@ describe('<MessageInput />', function() {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
const input = screen.getByPlaceholderText('Your Message…')
|
const input = screen.getByRole('textbox')
|
||||||
|
|
||||||
fireEvent.change(input, { target: { value: 'hello world' } })
|
fireEvent.change(input, { target: { value: 'hello world' } })
|
||||||
fireEvent.keyDown(input, { key: 'Enter' })
|
fireEvent.keyDown(input, { key: 'Enter' })
|
||||||
|
|||||||
Reference in New Issue
Block a user