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

Hooli-style Popup #123

Merged
merged 13 commits into from
Aug 31, 2022
Merged

Hooli-style Popup #123

merged 13 commits into from
Aug 31, 2022

Conversation

Yanyshpolska
Copy link
Contributor

Hooli-style Popup

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

Hey!

Congratulations with your PR! 😎😎😎

Please, be sure you haven't followed common mistakes.

Also, be aware, that if you would silently ignore this recommendation, a mentor may think that you are still working on fixes. And your PR will not be reviewed. 😒

@Yanyshpolska
Copy link
Contributor Author

Thank you for providing chapter "Typical mistakes" for "popup task". It was helpful and I was able to get rid of all the unnecessary UI/LI tags. Also I have changed button MORE - now it becomes a button LESS when clicked.
Please, review.

@kasionio
Copy link
Contributor

Please try to reach Less button from the keyboard, now it looks impossible :)

@kasionio kasionio self-requested a review August 16, 2022 18:06
@Yanyshpolska
Copy link
Contributor Author

Hi! Last hour I have tried to solve this problem. The button is actually "more" button, so you can reach it on position between "always visible items" and "more items" items. And it indeed seems weird than you must press "tab" back to focus on the "Less" button. The "~" and "+" (as I understand, and as I tried) can reach only the next element in the document. If I add new checkbox button to the end of item list - it will nor reach upper element.
So, I have tried add radio button with "More" and "Less" items. But it behaved in the same manner as with the checkbox, so this solution didn't work here for me.
Also I have tried to set order of flex element for checkbox to sent it back, but it didn't change the real order of objects, so in it also didn't work.
I know this can be done with JS but I didn't find solution how to do it purely in HTML/CSS only.
Please point me in the right direction :)

@Yanyshpolska
Copy link
Contributor Author

Hi! As I understand, "alt" descriptions for icons in the popup menu are not necessary, so I've deleted them. I'm still waiting for advice about the "Less" button. Or I can remove it and hide the "More" button when pressing it.

Copy link
Contributor

@kasionio kasionio left a comment

Choose a reason for hiding this comment

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

Nice job, good code! Let's improve it a bit. Take a look at the comments and screenshot. Also, need to add a pointer on hover effect on the popup button and More button. Focus on popup button is not centered
image

@@ -0,0 +1,213 @@
/* base styles */
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove comments, they are not needed, code should be readable by its nature :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. My bad. I'll delete them.

@@ -0,0 +1,213 @@
/* base styles */
* {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}
/* ===============Menu text items======================= */
.menu__item_text {
/* display: block; */
Copy link
Contributor

Choose a reason for hiding this comment

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

all commented out code should be deleted

}
.menu__item_checkbox_label {
position: absolute;
height: 1.715em;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Please read the articles (these or any others) and add at least a couple of rems, to the corresponding classes. Rem is more used nowadays than em

<img
class="menu__item_picture_img"
src="./img/bell.png"
alt="Alerts"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this particular case, I believe that usage of the "alt" is reasonable: in case the picture is not loaded the user is still able to see picture caption which is aligned with advice from this article:
"Use the alt attribute for images that are used as more than decoration."

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it is reasonable, but the value is not correct

<nav class="menu__items">
<a class="menu__item_text menu__item" href="#">Mail</a>
<a class="menu__item_text menu__item" href="#">Images</a>

Copy link
Contributor

Choose a reason for hiding this comment

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

it is not needed to leave spaces in HTML file

</head>
<body>
<header>
<nav class="menu__items">
Copy link
Contributor

Choose a reason for hiding this comment

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

for plural naming better use list word for example, because item and items looks pretty the same and you need to pay much attention to see the difference

<div class="popup__wrapper">
<div class="popup__items">
<a href="#" class="popup__item">
<div class="popup__item_image_container">
Copy link
Contributor

Choose a reason for hiding this comment

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

you can try to remove this div or text span and reduce the amount of tags, or wrap text and img in one div and use flex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I use div-container-for-picture in purpose because all pictures have different sizes and this approach allows me to deal with it: regardless of the size of the picture, the menu item cells will be the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can specify image width explicitly in corresponding class for images. You can leave it, but this is far from optimal

@Yanyshpolska
Copy link
Contributor Author

Please check the code adjusted according to your comments. I have corrected the focus on the popup button and deleted extra spaces and all comments. Also, I have changed class names.

@Yanyshpolska Yanyshpolska requested a review from kasionio August 25, 2022 22:23
@Yanyshpolska
Copy link
Contributor Author

Please check the code adjusted according to your comments. I have removed "div-container-for-picture" and changed the "alt" value from "Alerts" to "Notifications".

Copy link
Contributor

@kasionio kasionio left a comment

Choose a reason for hiding this comment

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

Please add the hover pointer effect on popup button and More button

font-size: 100%;
line-height: 1;
font-size: 14px;
-ms-text-size-adjust: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this property mean?

a {
text-decoration: none;
}
ul li {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can leave just ul or li here

/>
</a>
<a class="menu__item_picture menu__item" href="#">
<img class="menu__item_picture_img" src="./img/logo.jpg" alt="User" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the "alt" value from "User" to "Profile".

Copy link
Contributor

Choose a reason for hiding this comment

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

The text should explain where the link goes if the image is inside an <a> element
So, it should be "Go to Profile page"

Copy link
Contributor

@kasionio kasionio Aug 30, 2022

Choose a reason for hiding this comment

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

Please make corresponding changes to alts

@Yanyshpolska
Copy link
Contributor Author

Added hover pointer and removed unnecessary rows.

@Yanyshpolska Yanyshpolska requested a review from kasionio August 29, 2022 20:04
Copy link
Contributor

@kasionio kasionio left a comment

Choose a reason for hiding this comment

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

Last steps ;)

}
.menu__item_checkbox_label {
position: absolute;
height: 1.715em;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please read the articles (these or any others) and add at least a couple of rems, to the corresponding classes. Rem is more used nowadays than em

@Yanyshpolska
Copy link
Contributor Author

Hi! Thanks for your comments. Reworked as advised. Please review.

@Yanyshpolska Yanyshpolska requested a review from kasionio August 30, 2022 19:57
Copy link
Contributor

@kasionio kasionio left a comment

Choose a reason for hiding this comment

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

nope, please read the articles and add rems where you think it is NEEDED, not everywhere.

@Yanyshpolska
Copy link
Contributor Author

Hi Illia. Of course, I read the articles which you suggested to me. I also read other articles and watched some videos about units of measure. I clearly understand the differences in EM and REM size units. But I don't know the "best practice" of using them. I believe that the experience of use will come with time and with the number of implemented projects.
This popup menu project is my first project. I have used EM units here only to have some practice with them. The first version of popup menu was written with the PX. In my CSS file I set the font size only one time only for the HTML tag. So I expect the behavior of EM and REM will be the same.
If you have some suggestions for "best practice" solutions with EM REM - I will gladly listen to them. But for now, I can only guess where to use EM or REM units better in this particular project and I did the best I can considering my current knowledge.
According to the articles I read (https://zellwk.com/blog/rem-vs-em/, https://zellwk.com/blog/media-query-units/) I have found some suggestions for using EM and REM: "Size in em if the property scales according to its font-size", "Size everything else in rem." "Use em for media queries." According to your article, I have changed "border-radius" to EM.

@kasionio
Copy link
Contributor

Nice answer, fair enough ;) I guess it is time to go to the next tasks 🚀

@kasionio kasionio merged commit 322e39f into kottans:main Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants