Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

feat(Modal): Only renders modal in DOM when visible #95

Merged
merged 3 commits into from
Jan 8, 2020

Conversation

mathewmorris
Copy link
Contributor

@mathewmorris mathewmorris commented Jan 8, 2020

This is specific to accessibility and testing in general (though it's not a change to make testing work right, this was a problem that was unearthed by testing actually).

Modals and their content were being rendered when not visible, and so readable by screen readers which would not make sense if it's not showing. Now, the modal and it's content will render when it is supposed to be visible. 🎉

Makes the close icon a button. Also, it gives autofocus back to content.

No breaking changes.

@mathewmorris mathewmorris requested a review from a team January 8, 2020 16:29
@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #95 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   66.15%   66.15%           
=======================================
  Files          21       21           
  Lines         458      458           
  Branches       93       93           
=======================================
  Hits          303      303           
  Misses        124      124           
  Partials       31       31

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81e7057...8dc5e68. Read the comment docs.

@kylealwyn
Copy link
Contributor

@mathewmorris Awesome! One note - It looks like the inputs in the Modals have the autoFocus attribute but they're not autofocusing

@mathewmorris
Copy link
Contributor Author

@kylealwyn Yeah, looks like the focus goes to the Cancel button first (which doesn't have a nice focus state I might add). I will get the autofocus on the input 👍

@mathewmorris mathewmorris force-pushed the feat/modal-rendering-solution branch from 28d3eb4 to 3b55d4a Compare January 8, 2020 18:04
{title}
</Modal.Title>
)}
{title && <Modal.Title role="heading">{title}</Modal.Title>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional to remove the tab-index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. So it doesn't take the focus when the content of the modal has something that needs autofocus.

tabIndex="0"
/>
</Box>
<Button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to specify type="button" incase this component is wrapped into a form.

Copy link
Contributor

@alextranwork alextranwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with minor comments

@mathewmorris mathewmorris merged commit 94e73c0 into master Jan 8, 2020
@mathewmorris mathewmorris deleted the feat/modal-rendering-solution branch January 8, 2020 19:01
@ghost ghost requested review from choochootrain and erikshestopal January 8, 2020 21:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants