material icon indicating copy to clipboard operation
material copied to clipboard

autocomplete: suggestions don't show after $md-resize raised while something is selected

Open czesiu opened this issue 9 years ago • 4 comments

Actual Behavior:

  • What is the issue? * Suggestions don't show after clicking X or by clicking on input.
  • What is the expected behavior? Suggestions should show after clicking X or by clicking on input.

CodePen (or steps to reproduce the issue): *

  • CodePen Demo which shows your issue: https://codepen.io/anon/pen/Vzmyem (this is not changed basic demo from main angular material webpage)
  • Details: Choose something from autocomplete. Then resize browser window. Then click X. After that suggestions will not be displayed like normally.

AngularJS Versions: *

  • AngularJS Version: 1.5.7
  • AngularJS Material Version: 1.1.4

Additional Information:

  • Browser Type: * Chrome
  • Browser Version: * 59.0.3071.115
  • OS: * Windows

My fix which works, but I don't know if it is proper fix:

VirtualRepeatContainerController.prototype.updateSize = function() {
  // If the original size is already determined, we can skip the update.
  if (this.originalSize) return;

  var size = this.isHorizontal()
      ? this.$element[0].clientWidth
      : this.$element[0].clientHeight;
  
  if (size) {
    this.size = size;
  }

  // Recheck the scroll position after updating the size. This resolves
  // problems that can result if the scroll position was measured while the
  // element was display: none or detached from the document.
  this.handleScroll_();

  this.repeater && this.repeater.containerUpdated();
};

This is fix for this line: https://github.com/angular/material/blob/master/src/components/virtualRepeat/virtual-repeater.js#L225

czesiu avatar Aug 04 '17 13:08 czesiu

Duplicate of https://github.com/angular/material/issues/10283

Splaktar avatar Mar 01 '18 09:03 Splaktar

@Splaktar I know this is a duplicate of the other issue, but it does solve a valid bug in 3 lines of additional code. Consider merging to master?

mjgerace avatar Jun 04 '18 17:06 mjgerace

@mjgerace there is nothing to merge as this is an issue and not a PR. It would be great if you could test this fix. If it is effective, can you please submit a PR with the fix and a unit test?

Splaktar avatar Jun 10 '18 20:06 Splaktar

Reopening based on feedback in https://github.com/angular/material/issues/10283#issuecomment-434348823.

Splaktar avatar Nov 01 '18 19:11 Splaktar