Skip to content

Commit 370b7ed

Browse files
committed
kb(Dropdowns): Fix horizontal scrolling
1 parent 3d3d1fd commit 370b7ed

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

knowledge-base/dropdowns-disable-long-text-wrap.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ By default, the dropdown items are as wide as the dropdown. Text wrapping of lon
3838

3939
## Solution
4040

41-
1. Set a custom class in the component's `PopupSettings`.
42-
1. Apply a `white-space: nowrap;` style to the custom class.
43-
1. If a `PopupSettings` tag was not present until this point, also set a `Height`, otherwise it will change from `"200px"` to `"auto"`.
41+
One option is to [set a larger `Width` in the component's `PopupSettings`](#see-also). The algorithm below assumes that this is not the preferred approach.
42+
43+
1. Set a custom class in the [component's `PopupSettings`](#see-also).
44+
1. Apply a `white-space: nowrap` style to the custom class.
45+
1. (optional) Allow horizontal scrolling with an `overflow-x: auto` style on `.k-list-content`.
46+
1. If a `PopupSettings` tag was not present before, also set a `Height`, otherwise it will change from `"200px"` to `"auto"`.
4447

4548
>caption Disable text wrapping and overlapping of long dropdown items
4649
@@ -71,8 +74,16 @@ By default, the dropdown items are as wide as the dropdown. Text wrapping of lon
7174
</TelerikComboBox>
7275
7376
<style>
74-
.no-wrap {
77+
.no-wrap .k-list-content {
78+
/* prevent text wrapping */
7579
white-space: nowrap;
80+
/* allow horizontal scrolling */
81+
overflow-x: auto;
82+
}
83+
84+
.no-wrap .k-list-content li {
85+
/* expand items beyond 100% for proper selected and hover styles */
86+
width: max-content;
7687
}
7788
</style>
7889

0 commit comments

Comments
 (0)