1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-23 12:27:48 +00:00

[a11y] my libs: make operations such as 'share' available by keyboard

This commit is contained in:
llj
2021-09-22 16:50:36 +08:00
parent 4db1ef92e3
commit d8ba8eb606

View File

@@ -56,6 +56,14 @@ class MylibRepoListItem extends React.Component {
}; };
} }
onFocus = () => {
if (!this.props.isItemFreezed) {
this.setState({
isOpIconShow: true
});
}
}
onMouseEnter = () => { onMouseEnter = () => {
if (!this.props.isItemFreezed) { if (!this.props.isItemFreezed) {
this.setState({ this.setState({
@@ -277,7 +285,7 @@ class MylibRepoListItem extends React.Component {
let iconTitle = Utils.getLibIconTitle(repo); let iconTitle = Utils.getLibIconTitle(repo);
let repoURL = `${siteRoot}library/${repo.repo_id}/${Utils.encodePath(repo.repo_name)}/`; let repoURL = `${siteRoot}library/${repo.repo_id}/${Utils.encodePath(repo.repo_name)}/`;
return ( return (
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} onClick={this.onRepoClick}> <tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} onClick={this.onRepoClick} onFocus={this.onFocus}>
<td className="text-center"> <td className="text-center">
<a href="#" role="button" aria-label={this.state.isStarred ? gettext('Unstar') : gettext('Star')} onClick={this.onToggleStarRepo}> <a href="#" role="button" aria-label={this.state.isStarred ? gettext('Unstar') : gettext('Star')} onClick={this.onToggleStarRepo}>
<i className={`fa-star ${this.state.isStarred ? 'fas' : 'far star-empty'}`}></i> <i className={`fa-star ${this.state.isStarred ? 'fas' : 'far star-empty'}`}></i>