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

fix(dropdown): fix menu item text breaking issue #1838

Closed
wants to merge 18 commits into from

Conversation

ko2in
Copy link
Member

@ko2in ko2in commented Jan 10, 2021

Description

When the menu item contains too long text, the text doesn't break into the new line when there's no enough space to display in
single line and the text overflows the container.

Even though the text can be forced to break using break-word: break-all, it doesn't look good enough when there is an image representing next to the menu text.

menu

This PR fixes the menu item text breaking problem and also changes the container to flexbox to render the image, text, and the dropdown icon as flexbox items to align better.

Since the menu item has changed to the flexbox model and the dropdown icon and direct children elements of a menu item are appearing as flex items and the float property has no effect on flexbox, and so the float rules and variables for the dropdown icon are removed by this PR.

Testcase

Bug: https://jsfiddle.net/ko2in/3sw01eLz/1/

Fixed: https://jsfiddle.net/ko2in/3sw01eLz/9/

Screenshot

Before:
menu-bug

After:
menu-fix

Closes

#1820

When the menu item contains too long text, the text doesn't break
into the new line when there's no enought space to display in
single line and the text overflows the container.

This PR fixes the menu item text breaking problem and also changes
the container to flex box to render the image, text and the dropdown
icon as flex box items to align better.
@lubber-de lubber-de added lang/css Anything involving CSS state/awaiting-reviews Pull requests which are waiting for reviews type/bug Any issue which is a bug or PR which fixes a bug labels Jan 10, 2021
@lubber-de lubber-de added this to the 2.8.8 milestone Jan 10, 2021
Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

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

This unfortunately breaks 2 usecases i found

Testcase

Normal

https://jsfiddle.net/lubber/9yu8wr3v/12/

Your PR

https://jsfiddle.net/lubber/9yu8wr3v/14/

Screenshots

Normal

1838normal

Your PR

1838broken

@ko2in
Copy link
Member Author

ko2in commented Jan 11, 2021

@lubber-de I've fixed the floated icon issues. Please review again. I've updated the fiddle link (New link: https://jsfiddle.net/ko2in/3sw01eLz/7/) in my description.

There is also a left floated icon which has the right margin 1em, but a default icon without left floated has the right margin .78571429rem. I'm not sure why do they have two different values for margin. I think the left floated variant is not required since it's basically the default style.

@ko2in
Copy link
Member Author

ko2in commented Jan 11, 2021

@lubber-de I found a minor issue with icon alignment and description left-margin and fixed it. Here's the fiddle link (https://jsfiddle.net/ko2in/3sw01eLz/9/). You can compare with the previous version (https://jsfiddle.net/ko2in/3sw01eLz/7/).

@lubber-de
Copy link
Member

lubber-de commented Jan 11, 2021

Wow, this looks much better, i am still testing, but it seems you also fixed #1071 by 99%. 👍
Look at this jsfiddle https://jsfiddle.net/lubber/af71eLmr/5/
When running in IE11 / Edge 12 or Safari 12.1/13.1 the submenu arrow for "Submenu 2" is still misaligned while "Submenu 3" is fine now by your PR!)
image
Do you think you can fix this as well? (Don't worry, if not, i will still approve this PR, as it is much better overall with the flex settings and fixes the original issue and keeps everything else intact as before!)
We can also address this separately if ou dont want to touch this PR anymore, while it's stable

For local IE11 testing here is a standalone file
https://gist.github.com/lubber-de/2a8229f1eea16a9f6a81ed8841385d66

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

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

Basically LGTM 👍
Very good job!
Please change the little specifity as shown and remove the !important and use a doubled .ui instead (for both right floated selectors)

margin-left: @floatedDistance !important;
order: 1;
padding-left: @floatedDistance;
margin-left: auto !important;
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the !important and add another .ui to the selectors instead to increase specificity

@ko2in
Copy link
Member Author

ko2in commented Jan 12, 2021

@lubber-de Please hold for the PR for a moment. I also find some problems with the upward direction menu. I'll look into it and also your issue above and update the PR.

@lubber-de lubber-de added the state/on-hold Issues and pull requests which are on hold for any reason label Jan 13, 2021
@lubber-de lubber-de modified the milestones: 2.8.8, 2.8.x Jan 19, 2021
@lubber-de
Copy link
Member

lubber-de commented Jan 26, 2021

@ko2in Did you find a solution for your found upward directon issue? (i didnt came across that, so maybe you can share a jsfiddle to show what's wrong with your PR?)

You dont necessarily have to also fix the arrow icon i mentioned here because that's basicaly not related to your PR / issue

@ko2in
Copy link
Member Author

ko2in commented Jan 26, 2021

@lubber-de I did find out the solution for the upward direction menu. But, changing to the flexbox model reflects also some parts which I'm trying to fix. The vertical sidebar menu and accordion inside the menu are also affected by this change. I've fixed almost every issue I've found.

The icon issue you mentioned here doesn't relate to my PR. But, the icon positions are also affected too especially the left and right position and their margins which I'm trying to fix now. The margin inside the flexbox is really a challenge though.

I'll submit the updated PR this weekend if I didn't find anything else with my changes.

@lubber-de
Copy link
Member

@ko2in If you still have issues to solve, please convert this PR into Draft

@lubber-de lubber-de modified the milestones: 2.8.x, 2.9.x Aug 8, 2021
@lubber-de lubber-de marked this pull request as draft August 30, 2021 11:32
@lubber-de lubber-de removed the state/awaiting-reviews Pull requests which are waiting for reviews label Sep 23, 2021
ko2in added 11 commits May 16, 2023 17:32
to the dropdown item text since the icon display next to the text
when sub menu opens to the right direction as default.
to shift down to get better alignment along with the text and dropdown icon.

In previous version, the remove icon placed a few pixels above from
the text and dropdown icon which causes the inappropriate alignment.
doesn't support float in it's child elements.

Specify the order of label to display after the text.
the lowest order number should be specified.
incorrect alignment with the elements around when it contains
the content which takes more space vertically such as an image.

Instead, use `align-item` property on the text container to have
everything inside of it in a linear position.
causes the sub-menu positioned incorrectly when it's inside
floating dropdown item.
@ko2in ko2in marked this pull request as ready for review May 25, 2023 10:56
@auto-assign auto-assign bot requested a review from lubber-de May 25, 2023 10:56
@ko2in
Copy link
Member Author

ko2in commented May 25, 2023

@lubber-de I've fixed the conflicts with the base branch and merge my PR.

I've tested with all menu examples and various menu instances. Here's my fiddle.

Here is the summary about some additional fixes from my last commit.

Remove icon alignment

The remove icon wasn't aligned in the best position as it was shifted above comparing the text and dropdown icon.

Before
dropdown-remove-icon-not-aligned-properly

After
dropdown-remove-icon-aligend-properly

Sub-menu position in floating menu item

The sub-menu of dropdown item was not positioned correctly when the dropdown has floating variant. It was overlapping it's menu item.

Before
floating-left-sub-menu-bug

After
left-floating-sub-menu

Incorrect rounded corners and shadows of simple dropdown with upward direction

The rounded corners of upward simple dropdown menu should be top-left and top-right and the shadow should be displayed above the menu. That is fixed in this commit.

Before
upward-incorrect-shadow-and-rounded-border

After
upward-correct-shadow-and-rounded-border

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

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

Please revert the dist folder changes. They should not be part of the PR

@ko2in
Copy link
Member Author

ko2in commented May 25, 2023

Please revert the dist folder changes. They should not be part of the PR

These might have received when merging develop branch into my branch. 🤔

@lubber-de
Copy link
Member

Please revert the dist folder changes. They should not be part of the PR

These might have received when merging develop branch into my branch. 🤔

Try to rebase, because if the develop branch would have been merged there would not be any changes

@ko2in
Copy link
Member Author

ko2in commented May 27, 2023

Please revert the dist folder changes. They should not be part of the PR

These might have received when merging develop branch into my branch. thinking

Try to rebase, because if the develop branch would have been merged there would not be any changes

@lubber-de I've done rebasing, but I am not able to push to this branch anymore. So, I created another PR. I'm closing this PR.

@ko2in ko2in closed this May 27, 2023
@lubber-de lubber-de removed this from the 2.9.x milestone Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/css Anything involving CSS state/on-hold Issues and pull requests which are on hold for any reason type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants