Skip to content

Commit a5b7660

Browse files
author
Krzysztof Wilk
committed
Generate version 2.3.0
1 parent 1c7d7a7 commit a5b7660

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MDB 5 React
22

3-
Version: FREE 2.2.0
3+
Version: FREE 2.3.0
44

55
Documentation:
66
https://mdbootstrap.com/docs/b5/react/

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-react-ui-kit-demo",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"main": "index.js",
55
"repository": {
66
"type": "git",

app/src/components/Dropdown/DropdownLink/DropdownLink.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ const MDBDropdownLink: React.FC<DropdownLinkProps> = ({
88
className,
99
tag: Tag,
1010
children,
11+
disableClass,
1112
...props
1213
}): JSX.Element => {
13-
const classes = clsx('dropdown-item', className);
14+
const classes = clsx(!disableClass && 'dropdown-item', className);
1415

1516
const { handleClose } = useContext(DropdownContext);
1617

app/src/components/Dropdown/DropdownMenu/DropdownMenu.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,19 @@ const MDBDropdownMenu: React.FC<DropdownMenuProps> = ({
6161

6262
const handleDown = useCallback(
6363
(e: any) => {
64-
e.preventDefault();
65-
6664
if (attachELements) {
6765
if (e.key === 'ArrowUp') {
66+
e.preventDefault();
67+
6868
setCount(count - 1);
6969

7070
if (count <= 0) {
7171
setCount(childrenLength - 1);
7272
}
7373
}
7474
if (e.key === 'ArrowDown') {
75+
e.preventDefault();
76+
7577
setCount(count + 1);
7678

7779
if (count === childrenLength - 1) {

app/src/components/Modal/Modal.tsx

+23-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const MDBModal: React.FC<ModalProps> = ({
2222
const [isOpenModal, setIsOpenModal] = useState(show);
2323
const [innerShow, setInnerShow] = useState(show);
2424
const [staticModal, setStaticModal] = useState(false);
25+
const [focusedElement, setFocusedElement] = useState(0);
2526

2627
const modalInnerRef = useRef<HTMLElement>(null);
2728
const modalReference = modalRef ? modalRef : modalInnerRef;
@@ -66,6 +67,12 @@ const MDBModal: React.FC<ModalProps> = ({
6667

6768
const handleKeydown = useCallback(
6869
(event: KeyboardEvent) => {
70+
if (isOpenModal && event.key === 'Tab') {
71+
event.preventDefault();
72+
73+
setFocusedElement(focusedElement + 1);
74+
}
75+
6976
if (closeOnEsc) {
7077
if (isOpenModal && event.key === 'Escape') {
7178
if (!staticBackdrop) {
@@ -79,9 +86,24 @@ const MDBModal: React.FC<ModalProps> = ({
7986
}
8087
}
8188
},
82-
[closeModal, isOpenModal, staticBackdrop, closeOnEsc]
89+
[closeModal, isOpenModal, staticBackdrop, closeOnEsc, focusedElement]
8390
);
8491

92+
useEffect(() => {
93+
const focusableElements = modalReference.current?.querySelectorAll(
94+
'button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])'
95+
);
96+
97+
if (focusableElements && focusableElements.length > 0) {
98+
if (focusedElement === focusableElements.length) {
99+
(focusableElements[0] as HTMLElement).focus();
100+
setFocusedElement(0);
101+
} else {
102+
(focusableElements[focusedElement] as HTMLElement).focus();
103+
}
104+
}
105+
}, [focusedElement, modalReference]);
106+
85107
useEffect(() => {
86108
const getScrollbarWidth = () => {
87109
const documentWidth = document.documentElement.clientWidth;

dist/mdb-react-ui-kit.esm.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mdb-react-ui-kit.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-react-ui-kit",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"main": "./dist/mdb-react-ui-kit.js",
55
"module": "./dist/mdb-react-ui-kit.esm.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)