-
Notifications
You must be signed in to change notification settings - Fork 191
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
Make <table>
elements responsive automatically
#218
Comments
@ayumi-cloud I don't agree with making tables responsive as a carousel to slide between, I think in another solution like making some columns are fixed, plus support hiding unnecessary columns, making a list to choose which column to view? |
In regards to responsive tables, what about a right column with labels? While I do like responsive tables, I believe table behavior is relatively unique to the circumstance. Another example would be where one would have a smaller table that they'd want to stretch to fill a parent size. This overflow behavior is an option, not a default. |
This was discussed during the most recent telecon:
|
Adding this example of similar behavior in case it is useful. This is a solution we are currently using with Web Stories and we discussed looking at components behaving similarly ... Link to screenrecording: https://canddstudios.d.pr/Kc1BQd |
@cathibosco That behavior can be enabled by CSS scroll snap (see carousel demo at CSS Tricks), but whether current table layouts can utilize scroll snapping well I haven't looked into, so I suppose that's a consideration for modern/responsive data tables. |
@Malvoz yes, this can be achieved with scroll snapping, that said the original issue - and yours would be similar if we ever get around to defining a carasoul component is whether this behavior is defined given available container (not screen/viewport) real-estate. Thank you for the added example and your contribution was great! |
Also, the issue for the meta discussion was opened here: #237 |
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label. |
Scrolling (and scroll snapping) works, but is rarely the optimal solution. More often than not when there's not enough horizontal space you want to include labels on each row and lay it out differently (e.g. top to bottom, or like a card etc). Right now, while the laying out differently part is easy with CSS, there is no good way to get access to the column headers. All existing solutions are incredibly hacky and/or bloated. I'd love to explore ways to do this and give authors the primitives to make the styling decisions that best fit their use case. |
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label. |
Make
<table>
elements responsive to handle small screen devices on the x-axis.There are poor hacks to make
<table>
elements responsive such as this:https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_table_responsive
However, let's say we have a table with 100 rows and 25 columns on a single page.
7 out of 25 columns are only showing on a small screen device.
The user is viewing the table on a small screen device and half the table is hidden and hanging out of the right hand side of the screen.
A user scrolls down to row 50 of the 100 row table.
The user needs to scroll down to the bottom of the table to scroll the x-axis scroll bar to move the table right to see the missing right hand side data.
Then the user needs to navigate back up the page to row 50 to view the data.
This is a poor ux.
It would be better for
<table>
elements to be fully responsive and give better ux for people using themouse
ortouch screen
devices.A better solution would be to allow users to grab the table at the desired row and be able to move the whole table, instead of needing to go down to the bottom of the web page and use the scroll bar.
This feature can be turned on and off by adding an attribute to the
<table>
element, maybe?The attribute can control turning on the scrollbar and the grab function without the developer needing to wrap the
<table>
element with a<div>
tag and adding extra css.The text was updated successfully, but these errors were encountered: