Skip to content

Commit

Permalink
feat: update modal accessibility improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Chisomchima committed Feb 21, 2024
1 parent c5a160a commit 2f3802b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions collections/forms/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-02-19T11:41:26.003Z\n"
"PO-Revision-Date: 2024-02-19T11:41:26.003Z\n"
"POT-Creation-Date: 2024-02-21T10:19:12.883Z\n"
"PO-Revision-Date: 2024-02-21T10:19:12.883Z\n"

msgid "Upload file"
msgstr "Upload file"
Expand Down
10 changes: 8 additions & 2 deletions components/modal/src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Layer } from '@dhis2-ui/layer'
import { spacers, spacersNum, sharedPropTypes } from '@dhis2/ui-constants'
import cx from 'classnames'
import PropTypes from 'prop-types'
import React from 'react'
import React, { useEffect } from 'react'
import { resolve } from 'styled-jsx/css'
import { CloseButton } from './close-button.js'

Expand Down Expand Up @@ -35,7 +35,13 @@ export const Modal = ({
}
}

document.addEventListener('keydown', handleKeyDown)
useEffect(() => {
document.addEventListener('keydown', handleKeyDown)

return () => {
document.removeEventListener('keydown', handleKeyDown)
}
}, [onClose])

Check warning on line 44 in components/modal/src/modal/modal.js

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array

return (
<Layer
Expand Down

0 comments on commit 2f3802b

Please sign in to comment.