Skip to content

Add optional containerWidthAdjustment to ember-thead component#637

Merged
twokul merged 1 commit intoAddepar:masterfrom
kpfefferle:container-width-adjustment
Dec 6, 2018
Merged

Add optional containerWidthAdjustment to ember-thead component#637
twokul merged 1 commit intoAddepar:masterfrom
kpfefferle:container-width-adjustment

Conversation

@kpfefferle
Copy link
Copy Markdown
Member

Problem

When using custom CSS-styled scrollbars on the div.ember-table element, the vertical scrollbar covers some of the container's width. In browsers such as Chrome, this causes div.ember-table to also display a horizontal scrollbar to view the table content that is now covered by the vertical scrollbar.

Solution

In order to avoid this added horizontal scrollbar, @mixonic and I added here support for an optional argument to be passed to the ember-thead component called containerWidthAdjustment. This value gets passed along to the ColumnTree class to be applied to the calculated container width. This allows us to adjust the table width to account for the covering scrollbar in order to avoid a horizontal scrollbar in cases where we do not want one.

Alternatives

As we explored this problem, we originally passed in a custom function for calculating the container width that itself performed the necessary adjustment. While using a custom function could possibly account for more complex use cases, we ultimately decided that it was overkill for our current (and the seemingly most common) need to adjust the table width by a set value.

@kpfefferle kpfefferle force-pushed the container-width-adjustment branch 2 times, most recently from 8cd755d to f74fb8c Compare December 4, 2018 21:30
@mixonic
Copy link
Copy Markdown
Member

mixonic commented Dec 5, 2018

This looks good to me but should be accompanied by a test and documentation update.

@kpfefferle kpfefferle force-pushed the container-width-adjustment branch from f74fb8c to e8cfac5 Compare December 5, 2018 22:02
@kpfefferle
Copy link
Copy Markdown
Member Author

@mixonic Good call. I've added an accompanying test and a note to the docs.

@twokul twokul merged commit 20c22a8 into Addepar:master Dec 6, 2018
@kpfefferle kpfefferle deleted the container-width-adjustment branch October 17, 2019 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants