Files
jitsi-meet/react/features/chat/components/web/ChatDialogHeader.js
Steffen Kolmer e9675453e1 feat: Make Jitsi WCAG 2.1 compliant (#8921)
* Make Jitsi WCAG 2.1 compliant

* Fixed password form keypress handling

* Added keypress handler to name form

* Removed unneccessary dom query

* Fixed mouse hove style

* Removed obsolete css rules

* accessibilty background feature

* Merge remote-tracking branch 'upstream/master' into nic/fix/merge-conflicts

* fix error

* add german translation

* Fixed merge issue

* Add id prop back to device selection

* Fixed lockfile

Co-authored-by: AHMAD KADRI <52747422+ahmadkadri@users.noreply.github.com>
2021-06-10 07:48:44 -05:00

61 lines
1.4 KiB
JavaScript

// @flow
import React, { useCallback } from 'react';
import { translate } from '../../../base/i18n';
import { Icon, IconClose } from '../../../base/icons';
import { connect } from '../../../base/redux';
import { toggleChat } from '../../actions.web';
type Props = {
/**
* Function to be called when pressing the close button.
*/
onCancel: Function,
/**
* An optional class name.
*/
className: string,
/**
* Invoked to obtain translated strings.
*/
t: Function
};
/**
* Custom header of the {@code ChatDialog}.
*
* @returns {React$Element<any>}
*/
function Header({ onCancel, className, t }: Props) {
const onKeyPressHandler = useCallback(e => {
if (onCancel && (e.key === ' ' || e.key === 'Enter')) {
e.preventDefault();
onCancel();
}
}, [ onCancel ]);
return (
<div
className = { className || 'chat-dialog-header' }
role = 'heading'>
{ t('chat.title') }
<Icon
ariaLabel = { t('toolbar.closeChat') }
onClick = { onCancel }
onKeyPress = { onKeyPressHandler }
role = 'button'
src = { IconClose }
tabIndex = { 0 } />
</div>
);
}
const mapDispatchToProps = { onCancel: toggleChat };
export default translate(connect(null, mapDispatchToProps)(Header));