Skip to content

Commit

Permalink
Merge pull request #3052 from uswds/ext-fix-ios-footer
Browse files Browse the repository at this point in the history
[external] Fix iOS footer collapse on scroll
  • Loading branch information
thisisdano committed May 6, 2019
2 parents cb9b8b6 + 65fdf7a commit d6defd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/unit/footer/footer.spec.js
Expand Up @@ -88,7 +88,8 @@ describe('big footer accordion', () => {
});

it('closes panel on subsequent click', () => {
return resizeTo(400)
return resizeTo(800)
.then(() => resizeTo(400))
.then(() => {
buttons[0].click();
assertHidden(lists[ 0 ], false);
Expand All @@ -98,7 +99,8 @@ describe('big footer accordion', () => {
});

it('closes other panels on small screens', () => {
return resizeTo(400)
return resizeTo(800)
.then(() => resizeTo(400))
.then(() => {
buttons[0].click();
assertHidden(lists[ 0 ], false);
Expand Down
4 changes: 4 additions & 0 deletions src/js/components/footer.js
Expand Up @@ -30,7 +30,11 @@ function showPanel() {
}
}

let lastInnerWidth;

const resize = debounce(() => {
if (lastInnerWidth === window.innerWidth) return;
lastInnerWidth = window.innerWidth;
const hidden = window.innerWidth < HIDE_MAX_WIDTH;
select(COLLAPSIBLE).forEach(list => list.classList.toggle(HIDDEN, hidden));
}, DEBOUNCE_RATE);
Expand Down

0 comments on commit d6defd8

Please sign in to comment.