Add optional containerWidthAdjustment to ember-thead component#637
Merged
twokul merged 1 commit intoAddepar:masterfrom Dec 6, 2018
Merged
Add optional containerWidthAdjustment to ember-thead component#637twokul merged 1 commit intoAddepar:masterfrom
twokul merged 1 commit intoAddepar:masterfrom
Conversation
8cd755d to
f74fb8c
Compare
Member
|
This looks good to me but should be accompanied by a test and documentation update. |
f74fb8c to
e8cfac5
Compare
Member
Author
|
@mixonic Good call. I've added an accompanying test and a note to the docs. |
mixonic
approved these changes
Dec 6, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using custom CSS-styled scrollbars on the
div.ember-tableelement, the vertical scrollbar covers some of the container's width. In browsers such as Chrome, this causesdiv.ember-tableto also display a horizontal scrollbar to view thetablecontent 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-theadcomponent calledcontainerWidthAdjustment. 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.