Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(select): transparent background when overscrolling #2117

Merged
merged 5 commits into from
Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/select/_select-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
}

.md-select-content {
.md-select-content, .md-select-panel-done-animating {
background: md-color($background, card);
}

Expand Down
5 changes: 3 additions & 2 deletions src/lib/select/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
<span class="md-select-arrow"></span>
</div>

<template cdk-connected-overlay [origin]="origin" [open]="panelOpen" hasBackdrop (backdropClick)="close()"
<template cdk-connected-overlay [origin]="origin" [open]="panelOpen" hasBackdrop (backdropClick)="close()"
backdropClass="cdk-overlay-transparent-backdrop" [positions]="_positions" [minWidth]="_triggerWidth"
[offsetY]="_offsetY" [offsetX]="_offsetX" (attach)="_setScrollTop()">
<div class="md-select-panel" [@transformPanel]="'showing'" (@transformPanel.done)="_onPanelDone()"
(keydown)="_keyManager.onKeydown($event)" [style.transformOrigin]="_transformOrigin">
(keydown)="_keyManager.onKeydown($event)" [style.transformOrigin]="_transformOrigin"
[class.md-select-panel-done-animating]="_panelDoneAnimating">
<div class="md-select-content" [@fadeInContent]="'showing'">
<ng-content></ng-content>
</div>
Expand Down
16 changes: 15 additions & 1 deletion src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {TestBed, async, ComponentFixture} from '@angular/core/testing';
import {TestBed, async, ComponentFixture, fakeAsync, tick} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {Component, DebugElement, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {MdSelectModule} from './index';
Expand Down Expand Up @@ -542,6 +542,20 @@ describe('MdSelect', () => {
expect(fixture.componentInstance.select._placeholderState).toEqual('floating-rtl');
});


it('should add a class to the panel when the menu is done animating', fakeAsync(() => {
trigger.click();
fixture.detectChanges();

const panel = overlayContainerElement.querySelector('.md-select-panel');

expect(panel.classList).not.toContain('md-select-panel-done-animating');

tick(250);
fixture.detectChanges();

expect(panel.classList).toContain('md-select-panel-done-animating');
}));
});

describe('positioning', () => {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
/** The value of the select panel's transform-origin property. */
_transformOrigin: string = 'top';

/** Whether the panel's animation is done. */
_panelDoneAnimating: boolean = false;

/**
* The x-offset of the overlay panel in relation to the trigger's top start corner.
* This must be adjusted to align the selected option text over the trigger text when
Expand Down Expand Up @@ -345,6 +348,8 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
} else {
this.onClose.emit();
}

this._panelDoneAnimating = this.panelOpen;
}

/**
Expand Down