Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-responsive-element] Issue with repetitive resizing #1891

Closed
JS062512 opened this issue Sep 18, 2018 · 6 comments
Closed

[terra-responsive-element] Issue with repetitive resizing #1891

JS062512 opened this issue Sep 18, 2018 · 6 comments

Comments

@JS062512
Copy link

JS062512 commented Sep 18, 2018

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

  1. Slowly resize the width of a page that has a compressed and non-compressed view
  2. Once the form switches views stop resizing and see if the view switches once loaded
  3. If the view does not switch resize until you go back to the previous view
    (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

  • Component Name and Version: terra-responsive-element@3.9.1, terra-table@2.23.1, terra-list@2.23.1
  • Browser Name and Version:
  • Node/npm Version: [e.g. Node 8/npm 5]
  • Webpack Version:
  • Operating System and version (desktop or mobile):
@bjankord
Copy link
Contributor

@JS062512 Can we get a reduced test case to help us debug this further.

@bjankord bjankord added this to the Backlog milestone Sep 20, 2018
@tbiethman
Copy link
Contributor

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.

@tbiethman
Copy link
Contributor

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

@tbiethman
Copy link
Contributor

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.

ShettyAkarsh added a commit to ShettyAkarsh/terra-core that referenced this issue Jan 3, 2019
@ShettyAkarsh ShettyAkarsh self-assigned this Jan 3, 2019
@ShettyAkarsh ShettyAkarsh added this to In Review in Terra Jan 23, 2019
@bjankord bjankord removed this from In Review in Terra Feb 26, 2019
@bjankord
Copy link
Contributor

bjankord commented Mar 6, 2019

In addition to this issue, we'll also want to complete the work for #2048 in a separate PR. The goal will be to release the breaking changes in for this issue and the breaking changes for #2048 in 1 major release version.

bjankord pushed a commit that referenced this issue Jun 18, 2019
…breakpoints #1891 (#2141)

* Fixes Repititive Resizing issue #1891

* Added doc chenges

* Changes to upgrade.md file
@bjankord
Copy link
Contributor

Resolved with #2141

benbcai added a commit that referenced this issue Jun 24, 2019
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants