Skip to content

Commit

Permalink
Matt review
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 10, 2019
1 parent ee1e6a0 commit 015f714
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/material-ui-lab/src/SpeedDial/SpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,16 @@ const SpeedDial = React.forwardRef(function SpeedDial(props, ref) {

if (event.key === 'Escape') {
if (onClose) {
actions.current[0].focus();
onClose(event);
}
return;
}

if (getOrientation(key) === getOrientation(direction)) {
if (
getOrientation(key) === getOrientation(nextItemArrowKeyCurrent) &&
getOrientation(key) !== undefined
) {
event.preventDefault();

const actionStep = key === nextItemArrowKeyCurrent ? 1 : -1;
Expand All @@ -201,7 +205,6 @@ const SpeedDial = React.forwardRef(function SpeedDial(props, ref) {
if (!open) {
focusedAction.current = 0;
nextItemArrowKey.current = undefined;
// actions.current[0].focus();
}
}, [open]);

Expand Down Expand Up @@ -290,6 +293,7 @@ const SpeedDial = React.forwardRef(function SpeedDial(props, ref) {
},
delay: 30 * (open ? index : allItems.length - index),
open,
id: `${id}-action-${index}`,
});
});

Expand Down
10 changes: 9 additions & 1 deletion packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
delay = 0,
FabProps,
icon,
id,
open,
TooltipClasses,
tooltipOpen: tooltipOpenProp = false,
Expand Down Expand Up @@ -113,6 +114,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
tabIndex={-1}
role="menuitem"
style={transitionStyle}
aria-describedby={`${id}-label`}
{...FabProps}
>
{icon}
Expand All @@ -122,6 +124,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
if (tooltipOpenProp) {
return (
<span
id={id}
ref={ref}
className={clsx(
classes.staticTooltip,
Expand All @@ -130,7 +133,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
)}
{...other}
>
<span style={transitionStyle} className={classes.staticTooltipLabel}>
<span style={transitionStyle} id={`${id}-label`} className={classes.staticTooltipLabel}>
{tooltipTitle}
</span>
{fab}
Expand All @@ -140,6 +143,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {

return (
<Tooltip
id={id}
ref={ref}
title={tooltipTitle}
placement={tooltipPlacement}
Expand Down Expand Up @@ -180,6 +184,10 @@ SpeedDialAction.propTypes = {
* The Icon to display in the SpeedDial Fab.
*/
icon: PropTypes.node,
/**
* @ignore
*/
id: PropTypes.string,
/**
* @ignore
*/
Expand Down

0 comments on commit 015f714

Please sign in to comment.