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

Show horizontal table scrollbar only if necessary #200

Merged

Conversation

Tomasito665
Copy link
Contributor

Description

Main change
This pull request proposes setting the overflow-x CSS property of the table component to 'auto' to show the scrollbar only when it overflows its parent container.

Boyscouting
Furthermore, this pull request includes some boy-scouting changes to fix a link in the README and update the command to spin up the storybook to 'yarn start-storybook'. The old command, 'yarn storybook' did not work for me and, apparently, for many other people that asked about this on Slack. The answer to this question was usually: "Have you tried using 'start-storybook' instead? I took advantage of this pull request to update it.

Related Issue

N/A

Motivation and Context

Large tables were made scrollable back in 2021 by setting its overflow-x CSS property to 'scroll' 5343d38. While this indeed makes large tables scrollable, setting it to 'scroll' caused a horizontal scrollbar to appear also for smaller tables that do not require scrolling — see grey bar below table in screenshot. The aim of this pull request is to remove that scrollbar for small tables and show it only when necessary.

image

How Has This Been Tested?

This change was tested by manually opening a Parliament page with Google Chrome and updating the CSS property with its dev tools tab. See video demo below.

Screen.Recording.2024-02-28.at.23.33.15.mov

I tested the change locally with the storybook to assert that the change to src/Table/index.js updates the expected property.

image

Screenshots (if appropriate):

See above.

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:

  • I have signed the Adobe Open Source CLA.
  • 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.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

README.md Outdated
Comment on lines 56 to 59
This project uses [Storybook](http://storybook.js.org/) for testing the look and behavior of its UI components.

```bash
yarn storybook
yarn start-storybook
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we omit these changes? While they're good changes and I would generally accept them, they're out of scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi again - I filed a separate PR for this: #204

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@solimant solimant force-pushed the hide_table_scrollbar_when_not_needed branch from 8fba50e to 996c709 Compare March 1, 2024 06:08
@solimant solimant merged commit f2b0db3 into adobe:main Mar 1, 2024
3 checks passed
solimant added a commit that referenced this pull request Mar 1, 2024
Bump version to publish changes in #200
@solimant solimant mentioned this pull request Mar 1, 2024
10 tasks
solimant added a commit that referenced this pull request Mar 1, 2024
Bump version to publish changes in #200
@Tomasito665 Tomasito665 deleted the hide_table_scrollbar_when_not_needed branch March 1, 2024 10:03
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.

2 participants