Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbar Padding With Fixed Right Columns #265

Merged
merged 4 commits into from
Dec 18, 2017
Merged

Scrollbar Padding With Fixed Right Columns #265

merged 4 commits into from
Dec 18, 2017

Conversation

miskreant
Copy link
Contributor

@miskreant miskreant commented Dec 4, 2017

Description

Adds a spacer div to all rows if there is a vertical scrollbar present, resolves #260.

Motivation and Context

The spacing for the scrollbar was previously done by adjusting the width of the Scrollable Columns container. That fix no longer works with the addition of Fixed Right Columns since the Scrollable Columns are not guaranteed to be on the right edge anymore.

Now we add a spacer div on the right if the vertical scrollbar is present, and pull the Fixed Right Columns back by the width of said spacer (Scrollbar.SIZE). We also still need to keep part of the original fix and shrink the Scrollable Columns container, for situations when there is no Fixed Right Columns present.

How Has This Been Tested?

Locally

Screenshots (if appropriate):

screen

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

right fixed columns don't interfere with
the natural layout
@@ -631,6 +631,7 @@ var FixedDataTable = createReactClass({
onColumnResize={this._onColumnResize}
onColumnReorder={onColumnReorder}
onColumnReorderMove={this._onColumnReorderMove}
showScrollbarY={showScrollbarY}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's this value coming from? I don't see it above here in this method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I thought I'd moved that up already.. but it's from L:641 below. It only appeared to work for me because of the adjustedWidth stuff from my prior fix. I'll push up a fix shortly.

@@ -817,6 +820,7 @@ var FixedDataTable = createReactClass({

_renderRows(/*number*/ offsetTop) /*object*/ {
var state = this.state;
var showScrollbarY = state.maxScrollY > 0 && state.overflowY !== 'hidden' && state.showScrollbarY !== false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated above. Should we pull out to a helper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a good call. Do we want that to actually be in FixedDataTableScrollHelper.js, or just as an additional method here in FixedDataTable.js?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving a private method here is fine since it's only used in this file.

.public/fixedDataTable/header .public/fixedDataTableCell/main {
background-color: var(--fbui-desktop-background-light);
background-image: linear-gradient(#fff, #efefef);
}

.public/fixedDataTable/scrollbarSpacer {
position: absolute;
z-index: 99;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it need this z-index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the scrollbar itself overlays the elements below it, so the spacer needs to live on the same plane. Otherwise, this will happen:
screen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah cool, thanks for the image

@wcjordan
Copy link
Member

lgtm, can you update from master and verify everythings good to go?

* master:
  scrollableColumnIndex  and columnInfo.bodyScrollableColumn fix. (#259)
  Check old state while resizing (#269)
  Version 0.8.7
  Add rounding to horizontal scroll (#262)
@miskreant
Copy link
Contributor Author

Merged latest master in, this lgtm @wcjordan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unwanted space after last column with fixedRight and both horizontal/vertical scrollbars
2 participants