Design comparison
SolutionDesign
Community feedback
- @grace-snowPosted about 1 year ago
@MarioMinchevski make sure you're using a date library for this not doing manual calculations. I can enter in an invalid date of 29 Feb 2023 for example and no validation is being fired.
Other improvements I suggest
- Use a main landmark
- Use an sr-only h1 at least even though a heading hasn't been included in the design
- Use a fieldset and sr-only legend to encapsulate the 3 date fields
- Use autocomplete attributes on the date fields (See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#sect44)
- The submit button should hae a label of "submit" and the img icon alt text should be left blank
- The results box should have an aria-live attribute on it
- I recommend making the body a flex column, NOT a grid with place content center. The place-content center is causing the component to overflow on left and right on small screens, i.e. no longer honouring the margin you've set. Alternatively, if you want to use grid to center it, you need to use justify and align ITEMS center, not place-content center.
- The results box should have an sr-only h2
- The years months and days in the results are not headings for any other content so must not use heading elements. They are paragraphs, or even just one paragraph with spans inside.
- This does not fit on a screen that is 320px wide at the moment. This is an [essential WCAG accessibility success criteria[(https://www.w3.org/TR/WCAG21/#reflow). To fix, I recommend you set the max-width or width of the inputs to be 4-5ch for day and month and 6-7ch for year on mobile screens. You shouldn't be setting any widths in px anyway.
- Just as font size must never be in px, nor should letter spacing
- Styling should always be done mobile first and media queries must be defined in rem or em, never in pixels. More information
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord