Keyboard shortcuts and accessibility
This commit is contained in:
parent
8590a047c7
commit
20a892247f
87 changed files with 3652 additions and 711 deletions
|
@ -42,9 +42,8 @@ export class DocumentListItem extends React.Component<Props> {
|
|||
const { fileName, fileSize, timestamp } = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
<button
|
||||
className="module-document-list-item__content"
|
||||
role="button"
|
||||
onClick={this.props.onClick}
|
||||
>
|
||||
<div className="module-document-list-item__icon" />
|
||||
|
@ -59,7 +58,7 @@ export class DocumentListItem extends React.Component<Props> {
|
|||
<div className="module-document-list-item__date">
|
||||
{moment(timestamp).format('ddd, MMM D, Y')}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ interface Props {
|
|||
documents: Array<MediaItemType>;
|
||||
i18n: LocalizerType;
|
||||
media: Array<MediaItemType>;
|
||||
|
||||
onItemClick?: (event: ItemClickEvent) => void;
|
||||
}
|
||||
|
||||
|
@ -61,15 +62,26 @@ const Tab = ({
|
|||
};
|
||||
|
||||
export class MediaGallery extends React.Component<Props, State> {
|
||||
public readonly focusRef: React.RefObject<HTMLDivElement> = React.createRef();
|
||||
public state: State = {
|
||||
selectedTab: 'media',
|
||||
};
|
||||
|
||||
public componentDidMount() {
|
||||
// When this component is created, it's initially not part of the DOM, and then it's
|
||||
// added off-screen and animated in. This ensures that the focus takes.
|
||||
setTimeout(() => {
|
||||
if (this.focusRef.current) {
|
||||
this.focusRef.current.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { selectedTab } = this.state;
|
||||
|
||||
return (
|
||||
<div className="module-media-gallery">
|
||||
<div className="module-media-gallery" tabIndex={0} ref={this.focusRef}>
|
||||
<div className="module-media-gallery__tab-container">
|
||||
<Tab
|
||||
label="Media"
|
||||
|
|
|
@ -109,13 +109,9 @@ export class MediaGridItem extends React.Component<Props, State> {
|
|||
|
||||
public render() {
|
||||
return (
|
||||
<div
|
||||
className="module-media-grid-item"
|
||||
role="button"
|
||||
onClick={this.props.onClick}
|
||||
>
|
||||
<button className="module-media-grid-item" onClick={this.props.onClick}>
|
||||
{this.renderContent()}
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue