mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3367 from overleaf/ho-ms-jel-chat-a11y
Improve chat accessibility GitOrigin-RevId: 853da57460c7e3a18abbe1130553e34bd661b6b3
This commit is contained in:
parent
21ffe27bdd
commit
d138837049
3 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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' })
|
||||
|
|
Loading…
Reference in a new issue