should we set table.display to "table" explicitly
Related to https://github.com/rstudio/DT/issues/563
If the page contains a CSS claiming table.display to block. The whole page will display the datatable object strangely as long as the page is wider than the table.
Yes, I know adding another CSS could fix this but it frustrates the user and is difficult to debug.
Due to the fact that a datatable object could be displayed as expected, only when the table.display attribute is set to table.
So I'm proposing here that the datatable library should set this attribute by default.
The CSS that affect this issue
table {
display: block;
}
The test case
http://live.datatables.net/novewebi/1/edit
The output
http://live.datatables.net/novewebi/1
We could use table.dataTable { display: table; } but for 99% of cases it is redundant, which is why I would be mildly reluctant to put it in. It would be like putting in div { display: block } into regular html.
It's half right, as the metaphor is not very appropriate, in my opinion.
The reason is that regular tables will still be fine with display: block. They are just compacter, as expected.
But this doesn't apply to a datatable object. The implementation of datatable library (the header, footer, and buttons) can't get along withdisplay: block and only work with display: table. In other words, it's the implementation asks for it.
After a 2nd thought, I think this proposal may break users' existing code if they use dom: t(only the table body) with table {display: block;}, despite I doubt anyone will really do this...
So I'll leave it to you to decide if the issue should be closed or not.
Thanks!