Output from console.table cannot be copy-pasted nicely into a spreadsheet
Categories
(DevTools :: Console, enhancement, P3)
Tracking
(firefox111 fixed)
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: cers, Assigned: nchevobbe)
Details
Attachments
(2 files, 1 obsolete file)
4.03 KB,
patch
|
Details | Diff | Splinter Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
The output of console.table, while tabular, doesn't behave well when copy-pasted into a spreadsheet (currently I've only tested with google sheets).
Steps to reproduce
- Open console
- Run: console.table(Array(10))
- Select and copy output
- paste into spreadsheet
What happened?
The output now is all in one column, like so:
(index) |
---|
Values |
0 |
undefined |
1 |
undefined |
2 |
undefined |
3 |
undefined |
4 |
undefined |
5 |
undefined |
6 |
undefined |
7 |
undefined |
8 |
undefined |
9 |
undefined |
What should have happened?
Content should have been pasted into relevant cells, like:
(index) | Values |
---|---|
0 | undefined |
1 | undefined |
2 | undefined |
3 | undefined |
4 | undefined |
5 | undefined |
6 | undefined |
7 | undefined |
8 | undefined |
9 | undefined |
Reporter | ||
Comment 1•5 years ago
|
||
This is a WIP patch that fixes the problem by actually outputting a table, but because having a fixed header in an actual table is wonky, it's a little less than ideal.
Maybe someone knows another way of making it copy-pastable into a spreadsheet?
All my other attempts (like using display: table/table-row/table-cell) failed.
Assignee | ||
Comment 2•5 years ago
|
||
Yeah, I tried reverting back to a plain table with sticky th at some point, but that wasn't working well.
No idea how the grid gets translated into a string when copying (this has always been a very consuming thing to get right)
Reporter | ||
Comment 3•5 years ago
•
|
||
(In reply to Nicolas Chevobbe [:nchevobbe] from comment #2)
Yeah, I tried reverting back to a plain table with sticky th at some point, but that wasn't working well.
I think my patch is working pretty well, but there may be a slight difference in the borders. That might also be fixable though.
It's perhaps worth noting that Chrome doesn't have fixed headers - maybe it's not needed?
No idea how the grid gets translated into a string when copying (this has always been a very consuming thing to get right)
Maybe an alternative solution is to change the logic here https://dxr.mozilla.org/mozilla-central/source/dom/base/nsPlainTextSerializer.cpp#605 such that it's not just based on the tag name, but also/instead the display style? Maybe something with display: table-cell; should work the same as a td/th element?
Comment 4•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:nchevobbe, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•3 years ago
|
Reporter | ||
Comment 5•3 years ago
|
||
Updated version of the patch. It seems to work better now than before though.
Do I need to get a designer to look it over, or what is the path forward here?
Assignee | ||
Comment 6•3 years ago
|
||
Thanks Christian
Could you push your patch using moz-phab
(see https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html#to-submit-a-patch) ?
We will probably need to update https://searchfox.org/mozilla-central/source/devtools/client/webconsole/test/browser/browser_webconsole_console_table.js and https://searchfox.org/mozilla-central/source/devtools/client/webconsole/test/browser/browser_webconsole_console_table_post_alterations.js since you changed the markup. You should be able to run the test locally with mach test
(see https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html#to-test-a-change-locally)
Reporter | ||
Comment 7•3 years ago
|
||
Comment 8•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Updated•2 years ago
|
Comment 9•2 years ago
|
||
This has been requested also here: https://connect.mozilla.org/t5/ideas/make-console-table-results-paste-friendly-simply-by-adding-tab/idc-p/22023
Christian, this would be very nice enhancement. Any chance to finish the patch? Anything blocking it?
Comment 10•2 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:nchevobbe, since the bug has recent activity, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 11•2 years ago
•
|
||
Nicolas, should we mark this as good-first-bug?
Or rather do it ourselves?
Assignee | ||
Comment 12•2 years ago
|
||
yes, the patch attached only need a few adjustments, I'll update it and land it
Assignee | ||
Updated•2 years ago
|
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
bugherder |
Description
•