Problem/Motivation

Issue #1276908: Administrative tables are too wide for smaller screens added totally amazing responsive table functionality to Drupal 8. The logic in the new tableresponsive.js contains a wildly elaborate approach to removing the display: none from the table cells.

From the original issue, it looks like @jessebeach had concerns about trying to set the display property *back* to display: block or display: table-cell:

I left the code in that removes the display:none regexing. The problem with using a class (instead of $.show and $.hide) to expose the table columns, is the display property of a table cell must be set to table-cell in newer browsers and block in older browsers i.e. IE. And I didn't want to introduce logic to detect support of table-cell, which jQuery seems to do with the $.show method. The regex to pull out the display:none might offend the senses of some, but it's quite legit if not completely pleasing to one's sense of aesthetics.

However rather than trying to set the display property to something else, it'd be much easier just to remove the display: none style using jQuery (http://api.jquery.com/css/).

Setting the value of a style property to an empty string — e.g. $( "#mydiv" ).css( "color", "" ) — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's .css() method, or through direct DOM manipulation of the style property. It does not, however, remove a style that has been applied with a CSS rule in a stylesheet or

element.

Proposed resolution

Use $.fn.css() instead of custom code.

Remaining tasks

Review.

User interface changes

None.

API changes

None.
CommentFileSizeAuthor
#9 interdiff.txt1.86 KBaj2r
#9 2277761-9.patch1.86 KBaj2r
#1 tableresponsive-easier-2277761.patch1.53 KBquicksketch
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,631 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

quicksketch’s picture

FileSize
1.53 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,631 pass(es). View
nod_’s picture

Looks good, seems like tableresponsive.js isn't added to pages with responsive tables though…

droplet’s picture

Can we add back the code comments in above patch. It's the most important part of the code. Otherwise, calling hide() and then remove the display:none seems like a very stupid logic to everybody :)

nod_’s picture

Status: Needs review » Needs work

That works, and still applies. That said I agree with droplet, we need to keep the comments.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

aj2r’s picture

Issue tags: +Needs reroll
aj2r’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Needs work » Needs review
Issue tags: -Needs reroll +drupaldevdays, +DevDaysSeville
FileSize
1.86 KB
1.86 KB

Rerolled to 8.4.x and preserved comments.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.