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

[Filter field / Autocomplete] Virtualized elements change width of overlay when scrolled into view. #1420

Closed
kaikcreator opened this issue Aug 3, 2020 · 2 comments · Fixed by #1433
Assignees
Labels
bug A broken behaviour that was working previously has-pr

Comments

@kaikcreator
Copy link

Bug Report

Expected Behavior

Filter suggestions panel width should consider max with of their content from the beginning.

Current Behavior

Right now, the filter suggestions panel width only takes into account the data displayed when expanded, but if some wider content appears on scroll, the width of the panel is adjusted (causing an unsightly "jump" effect).

Steps to Reproduce

See live code: https://stackblitz.com/edit/github-g3mxzb

  1. Click in filter component
  2. Select item filter key
  3. Scroll down suggestions until some even much longer item is displayed
@kaikcreator kaikcreator added the bug A broken behaviour that was working previously label Aug 3, 2020
@tomheller
Copy link
Collaborator

Hey @kaikcreator! Thank you for reporting this, this seems like a problem with the virtualization of the items in the autocomplete component.

I will have a look.

@tomheller tomheller changed the title [Filter-field] [Filter field ] Aug 4, 2020
@tomheller tomheller changed the title [Filter field ] [Filter field / Autocomplete] Virtualized elements change width of overlay when scrolled into view. Aug 4, 2020
@tomheller
Copy link
Collaborator

I have tracked it down to the usage of the dt-highlight in the filter-field options, which wrap all option elements.

<dt-highlight [term]="_inputValue">{{
optionOrGroupDef.option!.viewValue
}}</dt-highlight>

The dt-highlight only renders, when it is in viewport, which let's the dropdown grow as you scroll down, because the options only are rendered in the dom when they become visible.

this._isInViewportSubscription = createInViewportStream(
this._elementRef,
0,
).subscribe((value) => {
this._isInViewport = value;
if (value) {
this._highlight();
}
});

tomheller added a commit that referenced this issue Aug 4, 2020
When the highlight was wrapped in an option in the filter field and out of view, it was not
initially rendered, but broke the layout of the autocomplete overlay by being too small.

When running and forcing highlight after the init a first time, the value will be mirrored into the
visible span, therefor giving it the size it should eventually have.

Fixes #1420
@tomheller tomheller self-assigned this Aug 5, 2020
lukasholzer pushed a commit that referenced this issue Aug 13, 2020
When the highlight was wrapped in an option in the filter field and out of view, it was not
initially rendered, but broke the layout of the autocomplete overlay by being too small.

When running and forcing highlight after the init a first time, the value will be mirrored into the
visible span, therefor giving it the size it should eventually have.

Fixes #1420
lukasholzer pushed a commit that referenced this issue Aug 18, 2020
When the highlight was wrapped in an option in the filter field and out of view, it was not
initially rendered, but broke the layout of the autocomplete overlay by being too small.

When running and forcing highlight after the init a first time, the value will be mirrored into the
visible span, therefor giving it the size it should eventually have.

Fixes #1420
yngrdyn pushed a commit to yngrdyn/barista that referenced this issue Nov 9, 2020
When the highlight was wrapped in an option in the filter field and out of view, it was not
initially rendered, but broke the layout of the autocomplete overlay by being too small.

When running and forcing highlight after the init a first time, the value will be mirrored into the
visible span, therefor giving it the size it should eventually have.

Fixes dynatrace-oss#1420
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A broken behaviour that was working previously has-pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants