Skip to content
Snippets Groups Projects
Commit de3a33c4 authored by chris's avatar chris
Browse files

fixes

parent a2dcfc8e
No related branches found
No related tags found
1 merge request!458Hhmi accessibility
...@@ -33,6 +33,7 @@ const DropDownButton = styled.button` ...@@ -33,6 +33,7 @@ const DropDownButton = styled.button`
`; `;
const DropDownMenu = styled.div` const DropDownMenu = styled.div`
visibility: ${props => (props.isOpen ? 'visible' : 'hidden')};
background: #fff; background: #fff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -88,9 +89,12 @@ const TableDropDown = ({ item }) => { ...@@ -88,9 +89,12 @@ const TableDropDown = ({ item }) => {
if (isDisabled) setIsOpen(false); if (isDisabled) setIsOpen(false);
}, [isDisabled]); }, [isDisabled]);
const openCloseMenu = e => { const openCloseMenu = () => {
// e.preventDefault();
if (!isDisabled) setIsOpen(!isOpen); if (!isDisabled) setIsOpen(!isOpen);
if (isOpen)
setTimeout(() => {
activeView.focus();
});
}; };
const onKeyDown = (e, index) => { const onKeyDown = (e, index) => {
...@@ -142,26 +146,20 @@ const TableDropDown = ({ item }) => { ...@@ -142,26 +146,20 @@ const TableDropDown = ({ item }) => {
> >
<span>Table Options</span> <StyledIcon name="expand" /> <span>Table Options</span> <StyledIcon name="expand" />
</DropDownButton> </DropDownButton>
<DropDownMenu <DropDownMenu isOpen={isOpen} role="menu">
role="menu"
style={{ visibility: isOpen ? 'visible' : 'hidden' }}
>
{dropDownOptions.map((option, index) => { {dropDownOptions.map((option, index) => {
itemRefs.current[index] = itemRefs.current[index] || createRef(); itemRefs.current[index] = itemRefs.current[index] || createRef();
return ( return (
<span <span
key={option.value} key={option.value}
onClick={e => { onClick={() => {
item.run( item.run(
activeView.state, activeView.state,
activeView.dispatch, activeView.dispatch,
tablesFn[option.value], tablesFn[option.value],
); );
setTimeout(() => { openCloseMenu();
activeView.focus();
});
openCloseMenu(e);
}} }}
onKeyDown={e => onKeyDown(e, index)} onKeyDown={e => onKeyDown(e, index)}
ref={itemRefs.current[index]} ref={itemRefs.current[index]}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment