Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Issue 216 - Scrollbar alignment#247

Merged
Marc-Andre-Rivet merged 4 commits intomasterfrom
3.1-issue216-scrolling-ui-offset-2
Nov 21, 2018
Merged

Issue 216 - Scrollbar alignment#247
Marc-Andre-Rivet merged 4 commits intomasterfrom
3.1-issue216-scrolling-ui-offset-2

Conversation

@Marc-Andre-Rivet
Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Nov 20, 2018

Fixes #216, #203.

After a pretty big false start, using a "phantom" div we can calculate the width of the vertical scrollbar and apply that width as an extra margin for the fixed rows section.. allowing scrolling to stay aligned throughout.

With disappearing scrollbars:
image

With always visible scrollbars:
image

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-247 November 20, 2018 02:40 Inactive
"@storybook/cli": "^4.0.2",
"@storybook/react": "^4.0.2",
"@storybook/cli": "^4.0.7",
"@storybook/react": "^4.0.7",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Having issues running storybook locally, updating fixes the issue -- local dep of react needs to be updated

resolve(width);
}, 0);
});
}; No newline at end of file
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Create a phantom div with a child to calculate the width of the scrollbar -- if the scrollbar disappears, it will have 0 width

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(Promise polyfill for IE11 is managed automatically by Babel)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good - I had a few questions about if this shouldn't just be a React component - had a small discussion with @Marc-Andre-Rivet and came to the conclusion that because this is just a calculation, it doesn't necessarily need to be a React component.


this.updateStylesheet();

getScrollbarWidth().then((scrollbarWidth: number) => this.setState({ scrollbarWidth }));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-evaluate scrollbar width on resize (to cover zoom case) and update state

const fragmentStyles: (CSSProperties | undefined)[][] = [
[
undefined,
{ marginRight: this.state.scrollbarWidth }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Add a margin to the fixed rows

@vedulaabhi
Copy link
Copy Markdown

Hi,

This Abhishek from Invesco. Just wanted to know if this issue is fixed and if not is there any workaround from styling perspective included in our code.

@Marc-Andre-Rivet
Copy link
Copy Markdown
Contributor Author

@vedulaabhi This PR should fix the issue in all known scenarios on all Mac and Windows browsers supported by the table. No additional workaround is necessary to make the fix work.

@vedulaabhi
Copy link
Copy Markdown

@Marc-Andre-Rivet will you be including this in the next release and if so can you pls let me know when we can expect the release as this is really important for our ispace app.

@Marc-Andre-Rivet
Copy link
Copy Markdown
Contributor Author

@vedulaabhi Once the review goes through this will be released as 3.1.7 -- this is the next release :)

Copy link
Copy Markdown
Contributor

@valentijnnieman valentijnnieman left a comment

Choose a reason for hiding this comment

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

A small nitpick, other than that it LGTM.

key={columnIndex}
ref={`r${rowIndex}c${columnIndex}`}
ref={`r${rowIndex}c${columnIndex}`}
style={fragmentStyles[rowIndex][columnIndex]}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small nitpick about indentation here. 🐱

resolve(width);
}, 0);
});
}; No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good - I had a few questions about if this shouldn't just be a React component - had a small discussion with @Marc-Andre-Rivet and came to the conclusion that because this is just a calculation, it doesn't necessarily need to be a React component.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Side scroll misalignment

4 participants