Skip to content

Commit

Permalink
use offsetWidth instead of getBoundingClientRect
Browse files Browse the repository at this point in the history
It fixes the tab's dimensions when inside a scaled down parent using CSS transform (ex: dialog)
  • Loading branch information
panthony committed Aug 4, 2017
1 parent 98a79b8 commit 903fd77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/components/paper-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default Component.extend(ChildMixin, RippleMixin, FocusableMixin, {

didInsertElement() {
this._super(...arguments);
let { width } = this.element.getBoundingClientRect();
let width = this.element.offsetWidth;
// this is the initial tab width
// it is used to calculate if we need pagination or not
this.set('width', width);
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export default Component.extend(ParentMixin, ColorMixin, {
},

updateDimensions() {
let { width: canvasWidth } = this.element.querySelector('md-tabs-canvas').getBoundingClientRect();
let { width: wrapperWidth } = this.element.querySelector('md-pagination-wrapper').getBoundingClientRect();
let canvasWidth = this.element.querySelector('md-tabs-canvas').offsetWidth;
let wrapperWidth = this.element.querySelector('md-pagination-wrapper').offsetWidth;
this.get('childComponents').invoke('updateDimensions');
this.set('canvasWidth', canvasWidth);
this.set('wrapperWidth', wrapperWidth);
Expand Down

0 comments on commit 903fd77

Please sign in to comment.