Skip to content

Conversation

@PVince81
Copy link
Member

@PVince81 PVince81 commented Jul 22, 2022

Goal was to reduce id duplication due to the fact that file lists are duplicated in DOM for the different sections of the files app.

Based on apps/files/templates/list.php, then searched for all files in the workspace that reference #$var or 'var' or "var":

  • #fileList

  • #filestable

  • #emptycontent

  • #controls

  • #notification <= likely important as it appears in multiple apps/files*/template/list.php files

  • check if those appear multiple times

    • #dir
    • #permissions
    • #select-all-files ?
  • probably unnecessary to replace:

    • #dirToken
    • #free_space
    • #uploadprogresswrapper

Further todos:

Tests:

  • file listing works all left sidebar sections
  • emptycontent in left sidebar sections
  • files drop still works
  • search results in files app still works
  • test columns and sorting in various file lists (due to name change)
  • recheck if Lighthouse in snapshot mode still reports duplicates after having clicked on various sections
  • public link page + upload
  • test activity
  • test viewer
  • test text app

@vinicius73
Copy link
Member

It was considered to use data-* attributes instead of class?

@PVince81
Copy link
Member Author

I don't think "data-*" attributes are adequate for addressing/querying elements, or at least less than classes

@PVince81 PVince81 marked this pull request as draft July 22, 2022 15:58
@vinicius73
Copy link
Member

I don't think "data-*" attributes are adequate for addressing/querying elements, or at least less than classes

My fear is that are very simple and generic selectors. Maybe we can use prefix to prevent collisions.

  • .nc-el--filelist
  • .nc-server--filelist
  • .nc-core--filelist
  • .nc--filelist

@PVince81
Copy link
Member Author

originally I wanted to keep the change minimal, considering that in the long term the file lists will be replaced with Vue components.

now, since you mention collisions, and since I already identified the locations to touch in the diff, it wouldn't hurt to use the opportunity to add a namespace. Thanks for bringing it up

@PVince81
Copy link
Member Author

I've now renamed "filestable" to "files-filestable" and "fileList" to "files-fileList"

@PVince81 PVince81 force-pushed the bugfix/noid/remove-files-duplicate-dom-ids branch from 287c439 to c1c5b8c Compare July 25, 2022 20:40
@PVince81
Copy link
Member Author

I've reverted the renaming of #permissions as it only ever appears once, so let's not open a can of worms where not needed

then I've renamed #controls to .files-controls and the JS tests all pass now

a bit more manual testing is needed and also more testing with Lighthouse after switching the sections to make sure there is no more duplicate id

@PVince81
Copy link
Member Author

PVince81 commented Jul 25, 2022

  • BUG: grid view in main file list is broken and doesn't appear!

  • BUG: ext storage section layout is broken

@PVince81 PVince81 force-pushed the bugfix/noid/remove-files-duplicate-dom-ids branch from c1c5b8c to 5f8ad36 Compare July 25, 2022 21:07
@PVince81 PVince81 marked this pull request as ready for review July 25, 2022 21:07
@PVince81
Copy link
Member Author

PVince81 commented Jul 25, 2022

  • BUG: summary row with "x files" is missing left padding outside of "all files", maybe some CSS selector is not matching

Copy link
Member

@Pytal Pytal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that global CSS necessitates the use of the files class namespace even in apps that aren't files like comments and systemtags but that is not a concern for this PR

@PVince81
Copy link
Member Author

there's a slight risk that CSS rule priorities will change a bit because targetting a class is weaker than an id.
it happened for the files summary which I just fixed

@PVince81 PVince81 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 26, 2022
@PVince81
Copy link
Member Author

thanks for the reviews. I'm going to check the dependent PRs before merging

@PVince81
Copy link
Member Author

PVince81 commented Jul 26, 2022

it has its own namespace "picker-fileList"

Replaced ids to classes for the following:

- #filestable -> .files-filestable
- #fileList -> .files-fileList
- #controls -> .files-controls
- #emptycontent -> .emptyfilelist.emptycontent

Signed-off-by: Vincent Petry <[email protected]>
@PVince81 PVince81 force-pushed the bugfix/noid/remove-files-duplicate-dom-ids branch from 3909357 to bb2557c Compare July 26, 2022 08:19
@PVince81
Copy link
Member Author

text app and activity are green

with viewer I'm struggling with CI, so probably I'll skip it and hope it will work with master

@PVince81 PVince81 added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 26, 2022
@PVince81 PVince81 merged commit b4353c4 into master Jul 26, 2022
@PVince81 PVince81 deleted the bugfix/noid/remove-files-duplicate-dom-ids branch July 26, 2022 10:21
@PVince81
Copy link
Member Author

Changes:
* #filestable => .files-filestable
* #fileList => .files-fileList
* #controls => .files-controls
* #emptycontent => .emptyfilelist.emptycontent
* #headerName => .column-name
* #headerDate => .column-mtime
* #headerSize => .column-size

@szaimen
Copy link
Contributor

szaimen commented Jul 26, 2022

  • find other apps that extend the files app?

Maybe the files_rightclick app?

@PVince81
Copy link
Member Author

Seems that global CSS necessitates the use of the files class namespace even in apps that aren't files like comments and systemtags but that is not a concern for this PR

ideally apps should never rely on those and should actually use the plugin API to attach themselves to the existing classes, like FileList, then they can access this.$table or other sub-elements

@PVince81
Copy link
Member Author

PVince81 commented Jul 26, 2022

I've grepped the release tarball:

apps/circles/templates/files/list.php
32:    <tbody id="fileList">

apps/circles/js/files/circles.files.list.js
233:                           this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty);

apps/circles/js/files/circles.files.list.js
225:                                   this.$el.find('#emptycontent').html('<div class="icon-systemtags"></div>' +
229:                                   this.$el.find('#emptycontent').html('<div class="icon-systemtags"></div>' +
232:                           this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty);

nothing else found!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish accessibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants