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

[Table] thead border-bottom width doesn't resize when resize window #3687

Closed
xdvarpunen opened this issue Mar 14, 2016 · 6 comments
Closed
Labels
bug 🐛 Something doesn't work component: table This is the name of the generic UI component, not the React module!

Comments

@xdvarpunen
Copy link

Hello,

I noticed the border-bottom width does not resize when resizing window. To repeat this create simple table and then open browser window as default with small size and put it to fullscreen.

-XDVarpunen

@EloB
Copy link
Contributor

EloB commented Mar 15, 2016

It's also on your docs page.
table-border-bug

@nathanmarks nathanmarks added the bug 🐛 Something doesn't work label Mar 15, 2016
@kinglion
Copy link

<TableHeader style={{borderBottom : 'none'}}>
<TableRow style={{borderBottom : 'none'}}>

can solve it but no good

@ledsun
Copy link

ledsun commented Jul 14, 2016

I found minimum reproduce code.

code

<!DOCTYPE html>

<body>
    Resize the window and this document wraped and height of this document is changed. So, the table will move but the bottom boder of the table will not move.
    <div style="transform: translate3d(0px, 0px, 0px);">
    </div>
    <table style="border-collapse: collapse;">
        <thead style="border-bottom-width: 1px; border-bottom-style: solid;">
            <tr>
                <th style="position: relative;">
                    header
                </th>
            </tr>
        </thead>
    </table>
</body>

browsers

This is reproduced on the Chrome 51.0.2704.103.

out

This is not reproduced on the Firefox 46.0.

styles

transform: translate3d(0px, 0px, 0px);

is used in a button tag on Table - Material-UI

position: relative;

is set in material-ui/TableHeaderColumn.js at master · callemall/material-ui

Question

Is position: relative; necessary?

@ledsun
Copy link

ledsun commented Jul 19, 2016

There is a limited workaround.

  1. Set TableHeaderColumn style {{position: "static"}}
  2. Hide all checkboxes

For example:

const TableExampleSimple = () => (
  <Table>
    <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
      <TableRow>
        <TableHeaderColumn style={{
          position: "static"
        }}>ID</TableHeaderColumn>
      </TableRow>
    </TableHeader>
    <TableBody displayRowCheckbox={false}>
      <TableRow>
        <TableRowColumn>1</TableRowColumn>
      </TableRow>
    </TableBody>
  </Table>
)

Demo

out

Source codes for demo

<body>
  <h1>Sapmle for [#3687](https://github.com/callemall/material-ui/issues/3687)</h1>
    Resize the window and this document wraped and height of this document is changed. So, the table will move but the bottom boder of the table will not move.


    <div style="transform: translate3d(0px, 0px, 0px);">
    </div>
    <div id="container">
    </div>

    <script src="bundle.js" charset="utf-8"></script>
</body>
const React = require('react');
const ReactDOM = require('react-dom');
const {getMuiTheme, MuiThemeProvider} = require('material-ui/styles');
const {
  Table,
  TableHeader,
  TableBody,
  TableRow,
  TableHeaderColumn,
  TableRowColumn
} = require('material-ui');

const FixedTableExample = () => (
  <Table>
    <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
      <TableRow>
        <TableHeaderColumn style={{
          position: "static"
        }}>ID</TableHeaderColumn>
      </TableRow>
    </TableHeader>
    <TableBody displayRowCheckbox={false}>
      <TableRow>
        <TableRowColumn>1</TableRowColumn>
      </TableRow>
    </TableBody>
  </Table>
)

const BrokenTableExample = () => (
  <Table>
    <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
      <TableRow>
        <TableHeaderColumn style={{
          position: "relative"
        }}>ID</TableHeaderColumn>
      </TableRow>
    </TableHeader>
    <TableBody displayRowCheckbox={false}>
      <TableRow>
        <TableRowColumn>1</TableRowColumn>
      </TableRow>
    </TableBody>
  </Table>
)

const App = () => (
  <MuiThemeProvider muiTheme={getMuiTheme()}>
    <div>
      <h2>FixedTableExample</h2>
      <FixedTableExample/>
      <h2>BrokenTableExample</h2>
      <BrokenTableExample/>
    </div>
  </MuiThemeProvider>
)

ReactDOM.render(
  <App/>, document.querySelector('#container'))

The limitation

If you show checkboxes, their th element has a style of position: relative.
This issue is reproduced on the column for checkboxes.

@oliviertassinari oliviertassinari added the component: table This is the name of the generic UI component, not the React module! label Dec 18, 2016
@oliviertassinari
Copy link
Member

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. While we haven't tested it, I think that the issue is most likely fixed on that branch. Hence, I'm closing it.
Still, we will accept PR fixes until v1-beta takes over the master branch.

@The-Code-Monkey
Copy link

The-Code-Monkey commented Sep 29, 2017

@oliviertassinari This is still broken on V1 branch as of today as I have a Table > TableBody > TableRow > TableCell and in table cell input but I resize the page and it doesnt wrap them or anything. Why does it do this I can provide code if need be.

Is there any way of fixing this as the ways above no longer work in V1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

7 participants