Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d99e293
Fix translations keys
May 24, 2022
b8c19a6
Add text to aria-label in the load file button and generate translati…
May 24, 2022
94ca655
Add text to aria-label in the send message button and generate transl…
fabiosurrage May 24, 2022
50bcc13
Add text to aria-label in the emoji button and generate translation key
fabiosurrage May 24, 2022
1238b1d
Update pt-BR translations
fabiosurrage May 24, 2022
4e65339
Fix pt-BR translations
fabiosurrage May 24, 2022
9b96bef
Fix button label and add translation
fabiosurrage May 24, 2022
f81312d
Remove 'outline: none' from buttons to indicate visual focus
fabiosurrage May 24, 2022
7613aa8
Fix color contrast
fabiosurrage May 25, 2022
407010c
Add keyboard navigation to option menu
fabiosurrage May 25, 2022
6bcaa41
Fix ARIA to options menu
fabiosurrage May 25, 2022
dc40d76
Fix keyboard navigation with NVDA in the options menu
fabiosurrage May 25, 2022
9005503
Add translations in emoji picker
fabiosurrage May 25, 2022
a37bec1
Add focus on chat when using keyboard
fabiosurrage May 26, 2022
20cd7d5
Fix to close chat when pressing 'Escape'
fabiosurrage May 26, 2022
a22ddea
Add Aria to Screen
fabiosurrage May 30, 2022
e32ca58
Fix keyboard navigation in screen chat
fabiosurrage May 30, 2022
ce3bcf8
Fix focus first element when state change
fabiosurrage May 30, 2022
b1cc3cb
Add feedback of sent and received messages
fabiosurrage May 30, 2022
661d2c5
Add keyboard navigation in ConfirmationModal
fabiosurrage May 30, 2022
e496987
Refactor key navigation event
fabiosurrage May 31, 2022
374a3d8
Add focus on close chat modal
fabiosurrage May 31, 2022
218b076
Fix first focus on input element
fabiosurrage Jun 7, 2022
e8b3d6f
Add role "log" to message list
fabiosurrage Jun 7, 2022
14f3344
Fix focus handler to wait next tick
fabiosurrage Jun 7, 2022
4f6fec5
Add focus to input when sending message
fabiosurrage Jun 7, 2022
4445fcb
Add key navigation to close chat
fabiosurrage Jun 7, 2022
6580964
FIx id name to avoid conflict
fabiosurrage Jun 7, 2022
fdc2130
Fix id name to avoid conflict
fabiosurrage Jun 7, 2022
7944bf1
Removed yarn.lock
fabiosurrage Jun 7, 2022
3a38209
Label to open/close the chat window and focus
fabiosurrage Jun 13, 2022
f1c3d93
Dockerfile to generate app
Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ coverage
package-lock.json
build.tar.gz
.DS_Store
yarn.lock
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM dockerhub.camara.leg.br/dockerhub/library/nginx:latest
ADD ./build /usr/share/nginx/html/
2 changes: 1 addition & 1 deletion src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class App extends Component {
};

return (
<Router history={history} onChange={this.handleRoute}>
<Router history={history} onChange={this.handleRoute} ref={this.handleAppRef}>
<ChatConnector default path='/' {...screenProps} />
<ChatFinished path='/chat-finished' {...screenProps} />
<GDPRAgreement path='/gdpr' {...screenProps} />
Expand Down
1 change: 1 addition & 0 deletions src/components/Avatar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class Avatar extends Component {
render = ({ small, large, src, description, status, className, style }, { errored }) => (
<div
aria-label='User picture'
aria-hidden='true'
className={createClassName(styles, 'avatar', { small, large, nobg: src && !errored }, [className])}
style={style}
>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ export const Button = memo(({
style = {},
children,
img,
label,
}) => (
<button
type={submit ? 'submit' : 'button'}
disabled={disabled}
onClick={onClick}
onMouseUp={handleMouseUp}
aria-label={icon ? children[0] : null}
aria-label={label ?? (icon ? children[0] : null)}
className={createClassName(styles, 'button', {
disabled,
outline,
Expand Down
11 changes: 10 additions & 1 deletion src/components/Composer/ComposerAction/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@import '../../../styles/helpers';
@import '../../../styles/colors';

$composer-action-margin: 0 6px;
$composer-action-color: $color-text-dark;
$composer-action-color-hover: $color-black;

.composer__action {
flex: 0 0 auto;
Expand All @@ -15,11 +18,17 @@ $composer-action-margin: 0 6px;
background: none;

font-size: 0;
color: $composer-action-color;

&:focus {
transform: scale(1.05);

outline: none;
// outline: none;
}

&:hover,
&:focus {
color: $composer-action-color-hover;
}

@include pressable-button(1px);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Composer/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $composer-focused-border-color: $color-text-grey;
$composer-input-min-height: 20px;
$composer-input-max-height: 150px;
$composer-input-padding: 2px 6px;
$composer-input-color: $bg-color-dark;
$composer-input-color: $color-text-darker;
$composer-input-font-size: 0.875rem;
$composer-input-font-weight: 500;
$composer-input-line-height: 1.25rem;
$composer-input-placeholder-color: $color-text-light;
$composer-input-placeholder-color: $color-text-grey;

.composer {
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const PoweredBy = withTranslation()(({ className, t, ...props }) => (

const handleMouseUp = ({ target }) => target.blur();

const OptionsTrigger = withTranslation()(({ pop, t }) => (
<button className={createClassName(styles, 'footer__options')} onClick={pop} onMouseUp={handleMouseUp}>
const OptionsTrigger = withTranslation()(({ pop, t, expanded }) => (
<button className={createClassName(styles, 'footer__options')} onClick={pop} onMouseUp={handleMouseUp} aria-haspopup='true' aria-expanded={expanded}>
{t('options')}
</button>
));
Expand Down
7 changes: 5 additions & 2 deletions src/components/Footer/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
@import '../../styles/helpers';
@import '../../styles/variables';

$footer-options-text-color: $color-text-grey;
$footer-options-text-color-hover: $color-black;

.footer {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -31,7 +34,7 @@
text-align: left;
letter-spacing: 0.2px;

color: $color-text-grey;
color: $footer-options-text-color;
border: none;
background: none;

Expand All @@ -41,7 +44,7 @@

&:hover,
&:focus {
color: black;
color: $footer-options-text-color-hover;
}

@include pressable-button(2px);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Picture = ({ children, className, ...props }) => (
);

export const Content = ({ children, className, ...props }) => (
<div className={createClassName(styles, 'header__content', {}, [className])} {...props}>
<div id='rocket-chat:header__content__id' className={createClassName(styles, 'header__content', {}, [className])} {...props}>
{children}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ $header-action-active-displacement: 2px;

color: inherit;
border: none;
outline: none;
// outline: none;
background: none;
justify-content: center;

Expand Down
40 changes: 39 additions & 1 deletion src/components/Menu/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { h, Component } from 'preact';

import { addFocusFirstElement, handleTabKey } from '../../lib/keyNavigation';
import { PopoverTrigger } from '../Popover';
import { createClassName, normalizeDOMRect } from '../helpers';
import styles from './styles.scss';
Expand All @@ -13,7 +14,7 @@ export const Menu = ({ children, hidden, placement, ...props }) => (


export const Group = ({ children, title, ...props }) => (
<div className={createClassName(styles, 'menu__group')} {...props}>
<div className={createClassName(styles, 'menu__group')} role='menu' {...props}>
{title && <div className={createClassName(styles, 'menu__group-title')}>{title}</div>}
{children}
</div>
Expand All @@ -24,6 +25,7 @@ export const Item = ({ children, primary, danger, disabled, icon, ...props }) =>
<button
className={createClassName(styles, 'menu__item', { primary, danger, disabled })}
disabled={disabled}
role='menuitem'
{...props}
>
{icon && (
Expand Down Expand Up @@ -52,6 +54,36 @@ class PopoverMenuWrapper extends Component {
dismiss();
}


handleCancel = () => {
const { dismiss } = this.props;
const { focusRef } = this.state;

if (focusRef) {
focusRef.focus();
}

dismiss();
}

handleKeyDown = (event) => {
const { key } = event;

switch (key) {
case 'Tab':
handleTabKey(event, this.menuRef.base);
break;
case 'Escape':
this.handleCancel();
break;
default:
break;
}

event.stopPropagation();

}

componentDidMount() {
const { triggerBounds, overlayBounds } = this.props;
const menuBounds = normalizeDOMRect(this.menuRef.base.getBoundingClientRect());
Expand All @@ -70,10 +102,15 @@ class PopoverMenuWrapper extends Component {

const placement = `${ menuWidth < rightSpace ? 'right' : 'left' }-${ menuHeight < bottomSpace ? 'bottom' : 'top' }`;

const focusRef = document.activeElement;

addFocusFirstElement(this.menuRef.base);

// eslint-disable-next-line react/no-did-mount-set-state
this.setState({
position: { left, right, top, bottom },
placement,
focusRef,
});
}

Expand All @@ -83,6 +120,7 @@ class PopoverMenuWrapper extends Component {
style={{ position: 'absolute', ...this.state.position }}
placement={this.state.placement}
onClickCapture={this.handleClick}
onkeydown={this.handleKeyDown}
>
{children}
</Menu>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
letter-spacing: 0;

border: none;
outline: none;
// outline: none;
background: none;

font-family: inherit;
Expand Down
26 changes: 24 additions & 2 deletions src/components/Messages/Message/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { formatDistance } from 'date-fns';
import format from 'date-fns/format';
import isToday from 'date-fns/isToday';
import { parseISO } from 'date-fns/fp';
import { h } from 'preact';
import { withTranslation } from 'react-i18next';

import { getAttachmentUrl, memo, normalizeTransferHistoryMessage, resolveDate } from '../../helpers';
import i18next from 'i18next';
import { getAttachmentUrl, memo, normalizeTransferHistoryMessage, resolveDate, createClassName } from '../../helpers';
import { default as AudioAttachment } from '../AudioAttachment';
import { FileAttachment } from '../FileAttachment';
import { ImageAttachment } from '../ImageAttachment';
Expand All @@ -28,6 +29,17 @@ import {
MESSAGE_TYPE_LIVECHAT_TRANSFER_HISTORY,
MESSAGE_WEBRTC_CALL,
} from '../constants';
import styles from './styles.scss';

const parseDate = (time) => {
const timestamp = new Date(time).toISOString();
return i18next.t('message_time', {
val: new Date(timestamp),
formatParams: {
val: isToday(parseISO(timestamp)) ? { hour: 'numeric', minute: 'numeric' } : { day: 'numeric', hour: 'numeric', minute: 'numeric' },
},
});
};

const renderContent = ({
text,
Expand All @@ -39,6 +51,8 @@ const renderContent = ({
attachmentResolver,
mid,
rid,
username,
time,
}) => [
...(attachments || [])
.map((attachment) =>
Expand Down Expand Up @@ -72,6 +86,12 @@ const renderContent = ({
),
text && (
<MessageBubble inverse={me} quoted={quoted} system={system}>
{!system && (
<span className={createClassName(styles, 'message--sr-only')}>
{me ? `${ i18next.t('i_say') } ` : `${ username } ${ i18next.t('says') } `}
{`${ parseDate(time) }:`}
</span>
)}
<MessageText text={text} system={system} />
</MessageBubble>
),
Expand Down Expand Up @@ -150,6 +170,8 @@ const Message = memo(({
mid: message._id,
rid: message.rid,
attachmentResolver,
username: message.u.name || message.u.username,
time: message.ts,
})}
</MessageContent>

Expand Down
10 changes: 10 additions & 0 deletions src/components/Messages/Message/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.message--sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
2 changes: 1 addition & 1 deletion src/components/Messages/MessageList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class MessageList extends MemoizedComponent {
onClick={this.handleClick}
style={style}
>
<ol className={createClassName(styles, 'message-list__content')}>
<ol className={createClassName(styles, 'message-list__content')} role='log' aria-live='polite' tabIndex={0}>
{this.renderItems(this.props)}
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Messages/MessageTime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const parseDate = (ts, t) => {
};

const MessageTime = memo(({ ts, normal, inverted, className, style = {}, t }) => (
<div className={createClassName(styles, 'message-time-wrapper')}>
<div className={createClassName(styles, 'message-time-wrapper')} aria-hidden='true'>
<time
dateTime={new Date(ts).toISOString()}
className={createClassName(styles, 'message-time', { normal, inverted }, [className])}
Expand Down
Loading