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

set disabled

parent 2f74b47b
No related branches found
No related tags found
1 merge request!458Hhmi accessibility
...@@ -20,14 +20,13 @@ import { v4 as uuidv4 } from 'uuid'; ...@@ -20,14 +20,13 @@ import { v4 as uuidv4 } from 'uuid';
const Wrapper = styled.div` const Wrapper = styled.div`
opacity: ${props => (props.disabled ? '0.4' : '1')}; opacity: ${props => (props.disabled ? '0.4' : '1')};
cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
`; `;
const DropDownButton = styled.button` const DropDownButton = styled.button`
background: #fff; background: #fff;
border: none; border: none;
color: #000; color: #000;
cursor: pointer; cursor: ${props => (props.disabled ? `not-allowed` : `pointer`)};
display: flex; display: flex;
position: relative; position: relative;
width: 160px; width: 160px;
...@@ -86,7 +85,7 @@ const DropComponent = ({ getPos, node, view }) => { ...@@ -86,7 +85,7 @@ const DropComponent = ({ getPos, node, view }) => {
return editable; return editable;
}); });
const isDisabled = false; const isDisabled = !isEditable;
const onChange = option => { const onChange = option => {
const allNodes = getNodes(main); const allNodes = getNodes(main);
...@@ -163,6 +162,7 @@ const DropComponent = ({ getPos, node, view }) => { ...@@ -163,6 +162,7 @@ const DropComponent = ({ getPos, node, view }) => {
<DropDownButton <DropDownButton
aria-expanded={isOpen} aria-expanded={isOpen}
aria-haspopup aria-haspopup
disabled={isDisabled}
onKeyDown={e => { onKeyDown={e => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === 40) { if (e.keyCode === 40) {
......
...@@ -13,14 +13,13 @@ import { WaxContext, Icon, useOnClickOutside } from 'wax-prosemirror-core'; ...@@ -13,14 +13,13 @@ import { WaxContext, Icon, useOnClickOutside } from 'wax-prosemirror-core';
const Wrapper = styled.div` const Wrapper = styled.div`
opacity: ${props => (props.disabled ? '0.4' : '1')}; opacity: ${props => (props.disabled ? '0.4' : '1')};
cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
`; `;
const DropDownButton = styled.button` const DropDownButton = styled.button`
background: #fff; background: #fff;
border: none; border: none;
color: #000; color: #000;
cursor: pointer; cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
display: flex; display: flex;
position: relative; position: relative;
width: 160px; width: 160px;
...@@ -136,6 +135,7 @@ const TableDropDown = ({ item }) => { ...@@ -136,6 +135,7 @@ const TableDropDown = ({ item }) => {
<DropDownButton <DropDownButton
aria-expanded={isOpen} aria-expanded={isOpen}
aria-haspopup aria-haspopup
disabled={isDisabled}
onKeyDown={e => { onKeyDown={e => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === 40) { if (e.keyCode === 40) {
......
...@@ -13,14 +13,13 @@ import { WaxContext, Icon, useOnClickOutside } from 'wax-prosemirror-core'; ...@@ -13,14 +13,13 @@ import { WaxContext, Icon, useOnClickOutside } from 'wax-prosemirror-core';
const Wrapper = styled.div` const Wrapper = styled.div`
opacity: ${props => (props.disabled ? '0.4' : '1')}; opacity: ${props => (props.disabled ? '0.4' : '1')};
cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
`; `;
const DropDownButton = styled.button` const DropDownButton = styled.button`
background: #fff; background: #fff;
border: none; border: none;
color: #000; color: #000;
cursor: pointer; cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
display: flex; display: flex;
position: relative; position: relative;
width: 215px; width: 215px;
...@@ -195,6 +194,7 @@ const DropDownComponent = ({ view, tools }) => { ...@@ -195,6 +194,7 @@ const DropDownComponent = ({ view, tools }) => {
<DropDownButton <DropDownButton
aria-expanded={isOpen} aria-expanded={isOpen}
aria-haspopup aria-haspopup
disabled={isDisabled}
onKeyDown={e => { onKeyDown={e => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === 40) { if (e.keyCode === 40) {
......
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