-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal component to update props when it receive new ones and fix erro… #507
Conversation
…r with react-modal
Travis automatic deployment: https://release-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://staging-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://staging-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://release-507-pr-onfido-sdk-ui-onfido.surge.sh |
MIGRATION.md
Outdated
// callback for when everything is complete | ||
console.log("everything is complete") | ||
}, | ||
steps: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: to keep the migration more focused you can remove the steps and let it default
README.md
Outdated
// callback for when everything is complete | ||
console.log("everything is complete") | ||
}, | ||
steps: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can drop steps
from here too.
on a side note: I'm a bit hesitant with adding long examples to side features. My fear is the readme can grow quite large
src/components/Modal/index.js
Outdated
portalClassName={style.portal} | ||
overlayClassName={style.overlay} | ||
bodyClassName={style.modalBody} | ||
className={style.inner} | ||
shouldCloseOnOverlayClick={true} | ||
closeTimeoutMS={MODAL_ANIMATION_DURATION} | ||
ariaHideApp={false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents react-modal
from throwing You must set an element with Modal.setAppElement(el) to make this accessible
. Thinking about it, this is probably not the best way of fixing the error because this will make the content behind the modal readable by screen readers. There is another fix and it involves passing appElement={document.body}
or appElement={document.getElementById('onfido-mount')}
. I think this is a better solution because it doesn't break screen readers. See discussion here reactjs/react-modal#576
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments on documentation
Travis automatic deployment: https://staging-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://release-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://staging-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://release-507-pr-onfido-sdk-ui-onfido.surge.sh |
Travis automatic deployment: https://507-pr-onfido-sdk-ui-onfido.surge.sh |
Problem
useModal: true
,react-modal
returnsUncaught Error: react-modal: You must set an element with
Modal.setAppElement(el)to make this accessible
You can see the error here https://jsfiddle.net/4xqtt6fL/1698/
isModalOpen
option was not properly received by theModal
component and this was causing issues when trying to close the modal using the close button.Solution
appElement={document.body}
to thereact-modal
component so it knows which element should be hidden from screen readers when the modal is open.componentWillReceiveProps(nextProps) {...}
to update the state of the ModalChecklist
put
n/a
if item is not relevant to PR changes