1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 18:30:53 +00:00

[a11y] dir view: enable 'keyboard access' for 'Tags'

This commit is contained in:
llj
2021-09-26 15:50:28 +08:00
parent c3273ddc52
commit f7e5fe2024
2 changed files with 10 additions and 3 deletions

View File

@@ -32,7 +32,8 @@ class DirTool extends React.Component {
};
}
onShowListRepoTag = () => {
onShowListRepoTag = (e) => {
e.preventDefault();
this.setState({
isRepoTagDialogShow: true,
isListRepoTagShow: true,
@@ -99,7 +100,7 @@ class DirTool extends React.Component {
return (
<Fragment>
<ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-tag" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a></li>
<li className="toolbar-item"><a className="op-link sf2-icon-tag" href="#" role="button" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a></li>
<li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
</ul>

View File

@@ -36,6 +36,12 @@ class RepoViewToolbar extends React.Component {
this.setState({ isOpen: !this.state.isOpen });
}
onDropdownToggleKeyDown = (e) => {
if (e.key == 'Enter' || e.key == 'Space') {
this.toggleMore();
}
}
visitDeletedviaKey = (e) => {
if (e.key == 'Enter' || e.key == 'Space') {
navigate(`${siteRoot}my-libs/deleted/`);
@@ -53,7 +59,7 @@ class RepoViewToolbar extends React.Component {
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Library')}
</button>
<Dropdown isOpen={this.state.isOpen} toggle={this.toggleMore}>
<DropdownToggle className='btn btn-secondary operation-item'>
<DropdownToggle className='btn btn-secondary operation-item' onKeyDown={this.onDropdownToggleKeyDown}>
{gettext('More')}
</DropdownToggle>
<DropdownMenu>