mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Make some ARIA promises
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
37d04d6ceb
commit
457f4c82db
4 changed files with 34 additions and 12 deletions
|
@ -67,7 +67,13 @@ class Category extends React.PureComponent {
|
||||||
const localScrollTop = Math.max(0, scrollTop - listTop);
|
const localScrollTop = Math.max(0, scrollTop - listTop);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="mx_EmojiPicker_category" data-category-id={this.props.id}>
|
<section
|
||||||
|
id={`mx_EmojiPicker_category_${this.props.id}`}
|
||||||
|
className="mx_EmojiPicker_category"
|
||||||
|
data-category-id={this.props.id}
|
||||||
|
role="tabpanel"
|
||||||
|
aria-label={name}
|
||||||
|
>
|
||||||
<h2 className="mx_EmojiPicker_category_label">
|
<h2 className="mx_EmojiPicker_category_label">
|
||||||
{name}
|
{name}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import {MenuItem} from "../../structures/ContextMenu";
|
||||||
|
|
||||||
class Emoji extends React.PureComponent {
|
class Emoji extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -30,14 +31,18 @@ class Emoji extends React.PureComponent {
|
||||||
const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props;
|
const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props;
|
||||||
const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode);
|
const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode);
|
||||||
return (
|
return (
|
||||||
<li onClick={() => onClick(emoji)}
|
<MenuItem
|
||||||
|
element="li"
|
||||||
|
onClick={() => onClick(emoji)}
|
||||||
onMouseEnter={() => onMouseEnter(emoji)}
|
onMouseEnter={() => onMouseEnter(emoji)}
|
||||||
onMouseLeave={() => onMouseLeave(emoji)}
|
onMouseLeave={() => onMouseLeave(emoji)}
|
||||||
className="mx_EmojiPicker_item_wrapper">
|
className="mx_EmojiPicker_item_wrapper"
|
||||||
|
label={emoji.unicode}
|
||||||
|
>
|
||||||
<div className={`mx_EmojiPicker_item ${isSelected ? 'mx_EmojiPicker_item_selected' : ''}`}>
|
<div className={`mx_EmojiPicker_item ${isSelected ? 'mx_EmojiPicker_item_selected' : ''}`}>
|
||||||
{emoji.unicode}
|
{emoji.unicode}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</MenuItem>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
class Header extends React.PureComponent {
|
class Header extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -26,13 +27,23 @@ class Header extends React.PureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<nav className="mx_EmojiPicker_header">
|
<nav className="mx_EmojiPicker_header" role="tablist">
|
||||||
{this.props.categories.map(category => (
|
{this.props.categories.map(category => {
|
||||||
<button disabled={!category.enabled} key={category.id} ref={category.ref}
|
const classes = classNames(`mx_EmojiPicker_anchor mx_EmojiPicker_anchor_${category.id}`, {
|
||||||
className={`mx_EmojiPicker_anchor ${category.visible ? 'mx_EmojiPicker_anchor_visible' : ''}
|
mx_EmojiPicker_anchor_visible: category.visible,
|
||||||
mx_EmojiPicker_anchor_${category.id}`}
|
});
|
||||||
onClick={() => this.props.onAnchorClick(category.id)} title={category.name} />
|
return <button
|
||||||
))}
|
disabled={!category.enabled}
|
||||||
|
key={category.id}
|
||||||
|
ref={category.ref}
|
||||||
|
className={classes}
|
||||||
|
onClick={() => this.props.onAnchorClick(category.id)}
|
||||||
|
title={category.name}
|
||||||
|
role="tab"
|
||||||
|
aria-selected={category.visible}
|
||||||
|
aria-controls={`mx_EmojiPicker_category_${category.id}`}
|
||||||
|
/>;
|
||||||
|
})}
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class QuickReactions extends React.Component {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
</h2>
|
</h2>
|
||||||
<ul className="mx_EmojiPicker_list">
|
<ul className="mx_EmojiPicker_list" aria-label={_t("Quick Reactions")}>
|
||||||
{QUICK_REACTIONS.map(emoji => <Emoji
|
{QUICK_REACTIONS.map(emoji => <Emoji
|
||||||
key={emoji.hexcode} emoji={emoji} onClick={this.props.onClick}
|
key={emoji.hexcode} emoji={emoji} onClick={this.props.onClick}
|
||||||
onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}
|
onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}
|
||||||
|
|
Loading…
Reference in a new issue