Chat App CSS Illustration

Solution retrospective
Always looking for ways to write cleaner and less bulky code, so keen to hear ways I can streamline parts of the projects or perfect the bits I haven't got exactly right. I'm also interested in how to better use ARIA for DIVS that don't really have a purpose.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @ksenius
Hi!
- I don't think using
role="presentation"
on adiv
is the correct way to use this attribute. I myself never used it, but what I understood from what I googled about it is that it should be used on elements with semantic meaning to remove that meaning. So, it has no sense to use it ondiv
s.
Also, this attribute affects not only the element it's applied on, but the children of that element too, and you used this attribute on every
div
.In my opinion, the better solution to hide the chat app illustration from assistive technologies would be using
aria-hidden="true"
on the parent element (the element with.phone
class in your case).I recommend you take a look at this article (or the article on MDN) if you want to learn more about presentation role.
- I don't know how much experience you have with CSS, but your
.msg-user-two
class is weird. It's not easy to understand why all those properties is used. The positioning of the chat messages on the right and on the left could have been done with a few lines of flexbox, example below:
.message-exchange { /* your code... */ display: flex; flex-direction: column; } .msg-user-two { align-self: flex-end; }
Much simpler.
- You can build pixel perfect (or maximally close to that) solutions by using PerfectPixel extension for Chrome.
- I don't think using
Join 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