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

Use scrollLeft to detect when scroll indicators should appear #853

Closed

Conversation

ahmacleod
Copy link
Contributor

If the table element has a negative margin-left style, the left scroll indicator will always show, even when scrolled all the way to the left. This negative margin trick is commonly used in conjunction with border-spacing and an overflow element in order to eliminate leading whitespace in the leftmost column of a table (border-spacing cannot be overridden at a cell level).

By examining scrollLeft instead of the bounding box positions of the table & overflow elements, the same effect is achieved without making any assumptions about the relative positions of elements.

Copy link
Member

@kpfefferle kpfefferle left a comment

Choose a reason for hiding this comment

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

I tested this out in my consuming app, and it seems to work well. This seems like a more robust solution for the long-term since it accounts for this additional use case 👍🏻

@ahmacleod
Copy link
Contributor Author

Made redundant by #854

@ahmacleod ahmacleod closed this Jan 22, 2021
@ahmacleod ahmacleod deleted the use-scroll-left-for-indicators branch January 22, 2021 23:31
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.

None yet

2 participants