[wp-trac] [WordPress Trac] #46005: Screen options: columns visibility not saved on mobile

WordPress Trac noreply at wordpress.org
Wed Jan 16 11:27:52 UTC 2019


#46005: Screen options: columns visibility not saved on mobile
----------------------------+-----------------------------------------
 Reporter:  afercia         |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  5.1
Component:  Administration  |    Version:  trunk
 Severity:  normal          |   Keywords:  has-screenshots needs-patch
  Focuses:  ui              |
----------------------------+-----------------------------------------
 Regression in trunk: Twelve months ago, [42644] / #40985 made the Screen
 Options toggle and panel visible also on mobile, for good reasons. Mobile
 users should be able to access all features. For example, as reported on
 #40985, they should be able to access the post `Discussion` meta box also
 when they're using a mobile device.

 The Screen Options are now visible on all screens. In the posts/pages
 lists, the visibility of the columns in the table is not saved correctly.

 Turns out the jQuery bits behind this feature check for the actual
 visibility of the columns using the jQuery selector `:hidden` and on
 mobile they're always hidden with `display: none` within an expandable
 panel so the check logic fails.

 For clarity, this is the panel that contains the "hidden columns":

 [[Image(http://cldup.com/SjxQkZo0Ko.png)]]


 To reproduce:
 - in the responsive view, go in the posts list
 - open the Screen Options and start with all the Columns checkboxes
 unchecked
 - refresh the page, checkboxes should now be in this state:

 [[Image(http://cldup.com/nyf8wWQ6Id.png)]]

 - check a couple of them
 - inspect the ajax request form data on your browser's dev tools network
 tab
 - see the form data contain `hidden: author,categories,tags,comments,date`
 (which means the code logic is failing and all the columns are still
 considered "hidden")
 - refresh the page
 - see all the checkboxes are still unchecked

 Note: when clicking "Apply", the form is submitted including the Columns
 data even if they've been previously saved via AJAX (this is a known
 issue) by the way the bug is still present I guess because the checkboxes
 value is set via JavaScript.

 See in `common.js` the related functions:

 {{{
 window.columns.init()
 window.columns.checked()
 window.columns.unchecked()
 window.columns.saveManageColumnsState()
 window.columns.hidden()
 }}}

 Suggested fix:
 instead of checking visibility with the jQuery selector `:hidden`:
 - either try a new method along the lines of what
 `window.columns.useCheckboxesForHidden()` does
 - or check for the `.hidden` CSS class on the columns

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46005>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list