EnxDev commented on code in PR #43966:
URL: https://github.com/apache/superset/pull/43966#discussion_r3952747280


##########
superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/DropdownContainer.tsx:
##########
@@ -328,6 +332,16 @@ export const DropdownContainer = forwardRef(
             gap: ${theme.sizeUnit * 4}px;
             margin-right: ${theme.sizeUnit * 4}px;
             min-width: 0px;
+            /* Some browsers can paint the mid-remeasure frame where all
+             * items are mounted; clamp so it doesn't overflow the bar.
+             * !important so a consumer's style prop can't defeat it. */
+            ${
+              recalculating &&
+              css`
+                max-width: ${lastRowWidthRef.current}px !important;

Review Comment:
   Good catch. Fixed in 191c89cd98: the transient row is clamped to the wrapper 
width reported by useResizeDetector instead of its previous content width. 
Since the row has min-width: 0 and participates in the flex layout, it can 
shrink around the trigger while still allowing a newly added item to use 
available space. The transient values are merged after consumer styles so they 
cannot be overridden during remeasurement.



##########
superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/DropdownContainer.tsx:
##########
@@ -179,6 +182,7 @@ export const DropdownContainer = forwardRef(
               childrenArray.map(child => child.getBoundingClientRect().width),
             );
           } else {
+            lastRowWidthRef.current = container.getBoundingClientRect().width;

Review Comment:
   Yes. Added a focused unit test in 191c89cd98 that starts with an overflowing 
row, changes the item count, and observes the all-items measurement frame. It 
verifies that the row is clamped to the 300px wrapper width with overflow 
hidden, even when the consumer style requests max-width: none and overflow: 
visible. The DropdownContainer suite passes: 15/15 tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to