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

Contra Frontend technical assessment #64

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

Conversation

TS-interview
Copy link

Summary

Had a lot of fun working on this. I usually use pre-built modals, so I didn't realize how much I took that for granted. Especially the accessibility support. This was honestly my first time developing/testing with a screen reader, and it won't be the last.

Design decisions

Decided to use styled-components to quickly create necessary styled components. If I were to scale this, I'd probably use a css framework like tailwind or chakra ui.
I also left the css within the js as I didn't have that many custom styled components, and keep everything in one place. If I were to keep using styled components, I'd probably audit all current components and create common re-usable components.

Changes made

  • Focus Management via focus-trap-react library.
  • Scroll lock.
  • Clicking outside of container closes modal.
  • Escape key closes modal.
  • Basic tab navigation within the modal.
  • Screen reader support with aria props.
  • Simple mobile support with responsive design.
  • Simple tests for the custom hooks.

Next steps

  • Create tests for @/components/modal.tsx and @/pages/index.tsx. Maybe cypress tests for an example critical flow with a modal (popup alert or a form within the modal).
  • Add multi-stack support

Loom

Link here

'^@/components/(.*)$': '<rootDir>/src/components/$1',
'^@/hooks/(.*)$': '<rootDir>/src/hooks/$1',
'^@/pages/(.*)$': '<rootDir>/src/pages/$1',
},
Copy link
Author

Choose a reason for hiding this comment

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

It would help to have this setup before interviewees start on the project.
Looks like this will be added by the Next team in the near future (link)

"eslint": "8.18.0",
"eslint-config-canonical": "35.0.1",
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "8.5.0",
"jest": "28.1.1",
"jest-environment-jsdom": "^29.0.1",
Copy link
Author

Choose a reason for hiding this comment

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

Would appreciate having this dependency pre-installed as well 😄


const closeHandler = useCallback(() => {
setOpen(false);
}, []);
Copy link
Author

Choose a reason for hiding this comment

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

Want to preface that preemptive performance changes are an anti-pattern, and these changes usually should be made after doing an internal investigation/audit (via 3rd party software like lighthouse).

const container = screen.getByTestId('overflow-container');
fireEvent.scroll(container, { target: { scrollY: 100 } });
expect(callback).toHaveBeenCalledTimes(1);
});
Copy link
Author

Choose a reason for hiding this comment

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

I'm not a fan of pushing skipped/broken tests, but for the sake of the assessment, I left it in.
Please forgive me 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant