Search Issue Tracker
By Design
Votes
0
Found in
2020.3.40f1
2021.3.10f1
2022.1.17f1
2022.2.0b8
2023.1.0a11
Issue ID
UUM-15771
Regression
No
UI Toolkit Width and Height behave inconsistently with margins when they are measured in percentage
Reproduction steps:
1. Open the attached project
2. Open “NewUXMLTemplate.uxml” file located in the Assets folder
3. Select “VisualElement” and change its Size to 100% Width and Height
Expected result: Width and Height behaves identically
Actual result: The element with its margin is fitted completely into a parent object for Height, but goes over for Width
Reproducible with: 2020.3.40f1, 2021.3.10f1, 2022.1.17f1, 2022.2.0b8, 2023.1.0a11
Reproducible on: macOS 12.6 (Intel)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Window preview appears on a different monitor when undocking and dragging a window with a high-resolution monitor set up on the right and a low-resolution monitor on the left.
- Probe Volume Baking Set Reference Documentation is missing
- Crash on RendererScene::NotifyInvisible when entering Play mode after undoing a change within the scene with Ctrl+z
- [iOS] Final Image misaligned when using "ScalableBufferManager.ResizeBuffers" to resize
- GameObjects are not updating when Materials and Cubemaps are updated from Environmental Reflections
Resolution Note:
The component default size is 100% but by default the flex shrink is 1 and reduce the size of the element so that it fit, along with its margins, in the flex direction.
You can set the flex shrink value to 0 along with width and height of 100% to have a fully symmetrical behavior where the element has exactly the same size of the parent.
Or you can set the flex grow on the element to 1 without setting any width and height.
https://jsfiddle.net/rf4p750e/