@pikapikamart
Posted
Great work on this one, your layout seems fine and it resizes well in mobile state.
Regarding your issue, well, since you are making it appearing and not appearing right, instead of making this display: none
then transitioning it to other display style. You could just made it opacity: 0
at first, then add opacity: 1
if the user clicks the submit button, that way your elements at the bottom will not be pushed down if the text appeared because of the display.
Hey, also adding a cursor: pointer
to the submit button will be much great, since it will feel more natural right, since it is an interactive element.
Overall, your work is great^
@fraserwat
Posted
@pikamart ah yeah, cool! This works! My concern here is that as the text is still there (just not showing up), it would still show up on e.g. screen readers, or not?
@pikapikamart
Posted
@fraserwat Well, if we were to use what I suggested, then the screen reader will read it even if it is invisible, the trick is applying aria-hidden=true
to the element when it is invisible and then when the error pop, we could just set the aria-hidden attribute to false in the listener, but it is quite long.
Instead another approach will be the visibility: hidden
instead of opacity. But first, sorry for suggesting opacity, I did not think about screen readers. visibility
styling will be your best choice in here, when no error, visibility: hidden
if the error appears, visibility: visible