Skip to content
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

feat: Modal Component #35

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: Modal Component #35

wants to merge 7 commits into from

Conversation

callinmullaney
Copy link
Contributor

@callinmullaney callinmullaney commented Jan 31, 2022

Summary

  • Adds a boilerplate modal component to compound.

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve?

  • Modals are a very common method of displaying content. It has been a prioritized component defined within the Emulsify UI-Kit initiative.

Documentation Update (required)

  • None

How to review this PR

  • checkout branch and run npm install then npm run storybook
  • Go to Molecules/Modal and confirm you can see multiple modal options. The functionality for each should be the same. The differences center around the markup that triggers the modal which can be any type of markup. It does not have to be triggered from a button/link only.
  • Use your keyboard to focus and trigger the modal. Verify the link within the modal is focus-able once the modal is active and pressing the esc closes the modal
  • Review the twig and styles and verify they are a good starting point for future projects and arent too opinionated.

@callinmullaney callinmullaney added the 👍 Ready for Review Work is ready for review. label Jan 31, 2022
@callinmullaney callinmullaney self-assigned this Jan 31, 2022
Copy link
Contributor

@mndonx mndonx left a comment

Choose a reason for hiding this comment

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

This looks great! I have some questions inline, and I also have a question about adherence to accessibility in this stripped-down format. I know we want to keep it simple, but I wonder if, bare minimum, it still passes contrast test. See attached.

Also - does it seem like the close button isn't appearing?
Screen Shot 2022-05-08 at 12 12 54 AM

@mndonx mndonx added the 👉 Needs Work Reviewer has requested changes. label May 8, 2022
@callinmullaney
Copy link
Contributor Author

@mndonx Thank you for the thorough review! I addressed your inline comments and added variable/block documentation for the twig file. I also made adjustments to the default colors we're using to help address the contrast warnings you mentioned. This will affect all components so hopefully should eliminate this accessibility error for others once merged.

One accessability error you will come across when re-testing is Ensures tabindex attribute values are not greater than 0 - This is intentional as it plays into the keyboard-trap JS and allows the modal to draw focus above everything else on a page.

Lastly, I fixed the icon display issue. Looks like the webpack script needed to explicitly point to the ./images/icons folder and not just ./images

@callinmullaney callinmullaney removed the 👉 Needs Work Reviewer has requested changes. label Jun 4, 2022
@callinmullaney callinmullaney marked this pull request as draft July 15, 2022 21:14
@callinmullaney callinmullaney marked this pull request as ready for review July 15, 2022 21:15
@callinmullaney
Copy link
Contributor Author

@joetower @ryanhagerty Adding you to this PR to help move things along if you have time. Can you confirm I addressed Amanda's feedback from above and let me know if this is ready for an accessibility review?

Copy link
Contributor

@ryanhagerty ryanhagerty left a comment

Choose a reason for hiding this comment

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

Great work Callin - halfway through the review I remembered I helped on this one - it's been a while! lol

Some general comments, but I don't think anything major.

position: fixed;
top: 0;

&--active {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably want to unnest this to modal__overlay--active to match updated best practices

components/02-molecules/modal/_modal.scss Show resolved Hide resolved
response = `<p>Could not process request. Error code: ${request.status}</p>`;
}
};
request.open('GET', url, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we including ajax functionality for the modal? This seems very strange to me. The modern standard is fetch, some people still prefer axios, and even fetching data from a modal seems like an edge case.

We should remove this. Kudos for trying to cover all the bases, but let's let the small amount of people doing this decide how they want to implement fetching data.

toggleChild.getAttribute('href') !== null
) {
e.preventDefault();
const request = new XMLHttpRequest();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should take all this out

<div {{ bem('content', modal__modifiers, modal__base_class) }}>
{% block modal__content %}
{% include "@atoms/text/text/01-paragraph.twig" with {
paragraph_content: modal_content,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we include modal content within a paragraph component? How do we know it will be text content? I think this should be a generic div

{% set modal__modifiers = modal__modifiers|default([]) %}

{% if modal__id is empty %}
{% set modal__id = random(100000) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I get why you made it random here - in case there's multiple modals right? But part of the accessibility for having the id is to correspond with the label.

Is a screenreader reading modal-35827-heading ideal? This might need a revisit

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you could set the random id up top and use it for the id and for the label?

components/02-molecules/modal/_modal.scss Show resolved Hide resolved
@ryanhagerty ryanhagerty added 👉 Needs Work Reviewer has requested changes. and removed 👍 Ready for Review Work is ready for review. labels Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👉 Needs Work Reviewer has requested changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants