detzt / BugReporting

Used to file Unity bug reports
MIT License
0 stars 0 forks source link

The height of the UIToolkit dropdown cannot be limited #4

Closed detzt closed 4 months ago

detzt commented 7 months ago

Bug report sent:

What happened A UI Toolkit dropdown field that has many choices extends below the visible screen. This is the first issue, as it should switch to scrolling before that and keep the list shorter by default. But there are also situations when a developer wants to keep the list even shorter by choice. However, setting the max-height property is not respected as it is overwritten by an internal script. Styling only the child elements leaves the border. Styling the parent element has no effect. Modifications are severely limited in general as the choices list is drawn on a separate VisualElement outside of the hierarchy that gets generated during runtime.

How can we reproduce it using the example you attached

  1. Run the SampleScene.
  2. Try to select Entry 25.
  3. Try to limit the height of the expanded dropdown by writing something in Stylesheet.uss.
detzt commented 4 months ago

Fixed in Unity 6000.0.0

Height is automatically limited to screen and further limiting also works by using:

.unity-base-dropdown__container-outer {
  max-height: 25%;
}