-
Notifications
You must be signed in to change notification settings - Fork 165
[terra-responsive-element] Issue with repetitive resizing #1891
Comments
@JS062512 Can we get a reduced test case to help us debug this further. |
I worked with @JS062512 to dig into this a little more. The issue is indeed caused by the scrollbar, particularly when the scrollbar is rendered as always visible (due to a mouse being detected or other settings being enabled). I'm not sure how tenable it will be to have the ResponsiveElement account for the presence of the scrollbar in its width-detection logic. The various browser implementations make that tricky, especially so given that a lot of that logic is itself encapsulated within the ResizeObserver. However, we could institute additional rules around what constitutes a valid ResponsiveElement child in order to help expose and mitigate the problem for consumers. Namely, a direct child of the ResponsiveElement should not be able to overflow; it should instead defer that need (if necessary) to a further child so that the scrollbar presence doesn't impact the element itself. |
The issue can be reproduced here by slowly transitioning between the tiny and small breakpoints: https://kaiju.cerner.com/projects/icy-mothra-8JU6_w/workspaces/bold-manda-tTn6xQ/preview |
Instead of introducing constraints on the parent/child items, I think we should be able to just use the parent elements offsetWidth value for our width calculations, as it will include any present scrollbar in the value: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth We'd just have to get that value manually instead of using the value directly given to us by the ResizeObserver. |
Resolved with #2141 |
* master: (48 commits) Update search-field-spec.js to increase the tolerance for the default search field (#2468) [terra-responsive-element] - Update examples to use React Hooks (#2469) Move Wiki Upgrade Guide to Deployed Upgrade Guide (#2467) Update UpgradeGuide.3.doc.jsx Update terra-mixin import file path (#2464) Resolve WCAG 2.1 AA issues (#2456) Add upgrade guide for terra-base (#2459) Publish Update changelogs [terra-icon] Updated Devdependencies (#2451) [terra-responsive-element] - Update documentation (#2463) Fix for Repetitive Resizing issue when scrollbar appears between two breakpoints #1891 (#2141) Fixed pageSet logic for total pages less than max allowed (#2458) Update UPGRADEGUIDE.md Additional null check for to handle empty query selectors in Form-Select. (#2455) [terra-core] Removed inline style for dev-site components Part 1 (#2427) [terra-responsive-element] - Update breakpoint ranges (#2452) update wdio tests to capture all interactions (#2443) Enable form-field required prop to pass down to children form fields (#2398) Cleanup WDIO Snapshots (#2454) ... # Conflicts: # packages/terra-form-select/src/_Frame.jsx # packages/terra-form-select/tests/wdio/_frame-spec.js # packages/terra-form-select/tests/wdio/select-field-spec.js # packages/terra-form-select/tests/wdio/select-spec.js
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Description
When resizing a page with multiple view types, such as different display types for small and large displays, there is a range of widths that can cause the formatting to become inconsistent. While within this width range the object will switch between view types rapidly. Once the view loads, the page seems to update and decide it should switch views, after switching views it then updates again and determines it should switch back to the previous view - creating an infinite loop.
This is a video showing one such page stuck in a loop of switching between two views Video of problem
Steps to Reproduce
(As we are unsure what combination of elements cause this issue it may not work on all pages that use terra-responsive-element)
Additional Context / Screenshots
Our code uses terra-responsive-element and uses terra-table for the expanded version and terra-SingleSelectList for the collapsed version.
For resizing we use default and 'small'
Expected Behavior
Resizing the width to change view types would make this change a single time instead of creating a loop of switching views.
Possible Solution
A possible source of the issue may be how the terra-responsive-element is getting the width for the terra-table and for the terra-SingleSelectList may be inconsistent, causing the view type to switch between the two. It also may be a problem with the scroll bar. Watching the video it seems the expanded version has a scroll bar that includes the header while the collapse version does not.
Environment
The text was updated successfully, but these errors were encountered: