Merge pull request #3367 from overleaf/ho-ms-jel-chat-a11y

Improve chat accessibility

GitOrigin-RevId: 853da57460c7e3a18abbe1130553e34bd661b6b3
This commit is contained in:
Jessica Lawshe
2020-11-09 08:52:34 -06:00
committed by Copybot
parent 21ffe27bdd
commit d138837049
3 changed files with 8 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ function ChatPane({
sendMessage,
userId
}) {
const { t } = useTranslation()
useEffect(() => {
loadMoreMessages()
}, [])
@@ -36,6 +37,7 @@ function ChatPane({
itemCount={messageContentCount}
>
<div>
<h2 className="sr-only">{t('chat')}</h2>
{loading && <LoadingSpinner />}
{shouldDisplayPlaceholder && <Placeholder />}
<MessageList

View File

@@ -15,7 +15,11 @@ function MessageInput({ resetUnreadMessages, sendMessage }) {
return (
<div className="new-message">
<label htmlFor="chat-input" className="sr-only">
{t('your_message')}
</label>
<textarea
id="chat-input"
placeholder={`${t('your_message')}`}
onKeyDown={handleKeyDown}
onClick={resetUnreadMessages}

View File

@@ -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() {
@@ -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.keyDown(input, { key: 'Enter' })