Skip to content

Commit

Permalink
Update: Make media viewer settings menu larger so scrollbars don't sh…
Browse files Browse the repository at this point in the history
…ow (#149)

Before, scrollbars could show on the various menus depending on your
scrollbar settings (e.g. OS settings, or mouse plugged in). This is
because the menu height was sized based on heights of items inside plus
padding, but forgot about border. Accounting for the 1px border fixes
this issue
  • Loading branch information
bhh1988 committed May 25, 2017
1 parent d2a6835 commit 7da7efc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/viewers/media/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ const SUBTITLES_SUBITEM_TEMPLATE = `<div class="bp-media-settings-sub-item" data
setMenuContainerDimensions(menu) {
// NOTE: need to explicitly set the dimensions in order to get css transitions. width=auto doesn't work with css transitions
this.settingsEl.style.width = `${menu.offsetWidth + 18}px`;
// height = n * $item-height + 2 * $padding (see Settings.scss)
// height = n * $item-height + 2 * $padding (see Settings.scss) + 2 * border (see Settings.scss)
// where n is the number of displayed items in the menu
const sumHeight = [].reduce.call(menu.children, (sum, child) => sum + child.offsetHeight, 0);
this.settingsEl.style.height = `${sumHeight + 16}px`;
this.settingsEl.style.height = `${sumHeight + 18}px`;
}

/**
Expand Down

0 comments on commit 7da7efc

Please sign in to comment.