Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

focus issue fixed #2204

Merged
merged 4 commits into from
May 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions frontend/src/components/worksheets/items/ActionButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import MenuItem from '@material-ui/core/MenuItem';

const StyledMenuItem = withStyles((theme) => ({
root: {
'&:focus': {
backgroundColor: theme.palette.primary.main,
'& .MuiListItemIcon-root, & .MuiListItemText-primary': {
color: theme.palette.common.white,
},
},
border: '2px solid #d3d4d5',
},
}))(MenuItem);
Expand Down Expand Up @@ -76,6 +70,8 @@ class ActionButtons extends React.Component<{
color='inherit'
id='upload-button'
aria-label='Add New Upload'
aria-controls='upload-menu'
aria-haspopup='true'
onClick={showUploadMenu}
disabled={!editPermission}
>
Expand All @@ -99,15 +95,32 @@ class ActionButtons extends React.Component<{
open={Boolean(uploadAnchor)}
onClose={closeUploadMenu}
>
<StyledMenuItem onClick={closeUploadMenu}>
{/* we need to hide the first menuItem
but make it available for accessibility
reference: https://snook.ca/archives/
html_and_css/hiding-content-for-accessibility */}
<StyledMenuItem
key='placeholder'
style={{
position: 'absolute',
overflow: 'hidden',
clip: 'rect(0 0 0 0)',
height: '1px',
width: '1px',
margin: '-1px',
padding: 0,
border: 0,
}}
/>
<StyledMenuItem key='file-upload-item' onClick={closeUploadMenu}>
<label
className={classes.uploadLabel}
htmlFor='codalab-file-upload-input'
>
File(s) Upload
</label>
</StyledMenuItem>
<StyledMenuItem onClick={closeUploadMenu}>
<StyledMenuItem key='folder-upload-item' onClick={closeUploadMenu}>
<label
className={classes.uploadLabel}
htmlFor='codalab-dir-upload-input'
Expand Down