-
Notifications
You must be signed in to change notification settings - Fork 169
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
MWPW-148439 - FIX - Text wraps under icon & No space between Icon and text in RTL Locale. #2343
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,15 @@ function decorateContent(el) { | |
const textContent = el.querySelectorAll('.text-content > :not(.icon-area)'); | ||
const secondColumn = createTag('div', { class: 'second-column' }); | ||
textContent.forEach((content) => { | ||
secondColumn.append(content); | ||
let nodeToInsert = content; | ||
const firstIcon = content.querySelector('.icon:first-child'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to be sure: you're targeting the icon that is the first sibling within its parent, right? If it had a text before it (or any other element), this would no longer select it and apply the logic. Is that the expectation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we need to select the first icon of the space and move the child of its parent tag, only after that we can do the styling. If there is no icon at first, we don't need to do anything. |
||
if (firstIcon) { | ||
const titleRowSpan = createTag('span', { class: 'title-row' }); | ||
titleRowSpan.append(firstIcon, content); | ||
nodeToInsert = titleRowSpan; | ||
} | ||
|
||
secondColumn.append(nodeToInsert); | ||
}); | ||
if (secondColumn.children.length === 1) el.classList.add('items-center'); | ||
el.querySelector('.foreground .text-content').append(secondColumn); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're already using flex, couldn't a
column-gap
be used instead of the more complex margin logic?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is primarily used to fix the text under the icon.
Yes,
column-gap
will solve this problem on pages written by ICON BLOCK. However, if RTL is enabled, it will not fix icon spacing on other pages.The goal is to solve the no space problem on all milo pages. As a result, we changed the margin in icon.js to
margin-inline
, allowing the margin to be added based on direction.