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

Commit 1a90a72

Browse files
topherfangioThomasBurleson
authored andcommitted
fix(mdBottomSheet): Enable touch interaction on mobile devices
When `<md-content>` recently added the `-webkit-overflow-scrolling: touch` CSS property, the `z-index` of the bottom sheet was placed into a separate stacking context and did not respect the `z-index` of the scroll mask. Fix by ensuring the bottom sheets appends the scroll mask to the same parent as the bottom sheet. Closes #4327.
1 parent 44504d8 commit 1a90a72

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/components/bottomSheet/bottom-sheet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function MdBottomSheetProvider($$interimElementProvider) {
161161
$mdTheming.inherit(bottomSheet.element, options.parent);
162162

163163
if (options.disableParentScroll) {
164-
options.restoreScroll = $mdUtil.disableScrollAround(options.parent);
164+
options.restoreScroll = $mdUtil.disableScrollAround(bottomSheet.element, options.parent);
165165
}
166166

167167
return $animate.enter(bottomSheet.element, options.parent)

src/components/bottomSheet/bottom-sheet.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,22 @@ describe('$mdBottomSheet service', function() {
7070
// Focus should be on the last md-autofocus element
7171
expect($document.activeElement).toBe(focusEl[1]);
7272
}));
73+
74+
// This test is mainly for touch devices as the -webkit-overflow-scrolling causes z-index issues
75+
// if the scroll mask is appended to the body element
76+
it('appends the scroll mask to the same parent', inject(function($mdBottomSheet, $rootScope) {
77+
var parent = angular.element('<div>');
78+
79+
$mdBottomSheet.show({
80+
template: '<md-bottom-sheet>',
81+
parent: parent
82+
});
83+
84+
$rootScope.$apply();
85+
86+
var scrollMask = parent[0].querySelector('.md-scroll-mask');
87+
88+
expect(scrollMask).not.toBeNull();
89+
}));
7390
});
7491
});

0 commit comments

Comments
 (0)