Skip to content

fix(ui5-li-custom): correct padding for ListItemCustom #11487

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/main/src/themes/ListItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,18 @@
margin-top: var(--_ui5_list_item_selection_btn_margin_top);
}

:host([ui5-li][_selection-mode="SingleStart"]) .ui5-li-root {
:host([ui5-li][_selection-mode="SingleStart"]) .ui5-li-root,
:host([ui5-li-custom][_selection-mode="SingleStart"]) .ui5-li-root {
padding-inline: 0 1rem;
}

:host([ui5-li][_selection-mode="Multiple"]) .ui5-li-root {
:host([ui5-li][_selection-mode="Multiple"]) .ui5-li-root,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the [ui5-li] selector needed here?

Including this selector allows the parent class to be aware of its child components. However, this approach has a downside: the corresponding CSS will be bundled with all components that extend the ListItem class, even though these selectors may never match in those contexts. This seems unnecessary and potentially inefficient. Please reconsider and revise the implementation accordingly, as the current setup appears conceptually flawed.

Copy link
Member Author

Choose a reason for hiding this comment

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

The selector is currently there to enforce stronger CSS specificity, but I agree it’s worth exploring if we can achieve the same effect with a cleaner setup. I’ll see what can be done to optimize it.

:host([ui5-li-custom][_selection-mode="Multiple"]) .ui5-li-root {
padding-inline: 0 1rem;
}

:host([ui5-li][_selection-mode="SingleEnd"]) .ui5-li-root {
:host([ui5-li][_selection-mode="SingleEnd"]) .ui5-li-root,
:host([ui5-li-custom][_selection-mode="SingleEnd"]) .ui5-li-root {
padding-inline: 1rem 0;
}

Expand Down
Loading