Bug 27934 - Table sorting using title-string option is obsolete
Summary: Table sorting using title-string option is obsolete
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords: Academy
Depends on: 27974 27975 27980 27982 27983 27990 27994 27998 28007 28016 28018
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-11 15:39 UTC by Martin Renvoize
Modified: 2021-04-17 18:05 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 27934: Update waiting_holds.inc to use data-order (2.25 KB, patch)
2021-03-12 09:00 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27934: Update waiting_holds.inc to use data-order (2.32 KB, patch)
2021-03-12 15:12 UTC, ByWater Sandboxes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2021-03-11 15:39:59 UTC
We have some interesting code in our datatables wrappers to magically sort on 'title' attributes found in spans in table fields (When the headings are marked up with 'title-string' and 'title-number' classes).

This is weird and a mis-use of the HTML title attribute. It results in tooltips being generated for all fields witch such values and often those tooltips are confusing/mismatched.

We should replace these with either data- attributes or perhaps use hidden datatables columns for sorting?


Basically.. there must be a better way.
Comment 1 Jonathan Druart 2021-03-11 15:56:08 UTC
It must be data-order

https://datatables.net/manual/data/orthogonal-data#HTML-5

We use it already in a few places.
Comment 2 Martin Renvoize 2021-03-12 08:54:11 UTC
That's a really useful page of documentation Jonathan, thanks for linking it :)
Comment 3 Martin Renvoize 2021-03-12 09:00:16 UTC
Created attachment 118182 [details] [review]
Bug 27934: Update waiting_holds.inc to use data-order

This patch updates the waiting_holds table to use data-order attributes
on the "Waiting since" and "Date hold placed" fields.

Test plan
1/ Prior to applying the patch navigate to a page that displays waiting holds
2/ Hover over the the "Waiting since" and "Date hold placed" data fields
and note that you are faced with a tooltip with the iso formatted date.
3/ Apply the patch
4/ Check that sorting still works as expected for the two columns
5/ You should no longer be able to trigger the tooltip
Comment 4 Martin Renvoize 2021-03-12 09:01:11 UTC
Example patch.. there's allot of these to fix...
Comment 5 Martin Renvoize 2021-03-12 09:02:56 UTC
Find more cases with a simple grep for 'title-string' in the templates directories
Comment 6 ByWater Sandboxes 2021-03-12 15:12:20 UTC
Created attachment 118206 [details] [review]
Bug 27934: Update waiting_holds.inc to use data-order

This patch updates the waiting_holds table to use data-order attributes
on the "Waiting since" and "Date hold placed" fields.

Test plan
1/ Prior to applying the patch navigate to a page that displays waiting holds
2/ Hover over the the "Waiting since" and "Date hold placed" data fields
and note that you are faced with a tooltip with the iso formatted date.
3/ Apply the patch
4/ Check that sorting still works as expected for the two columns
5/ You should no longer be able to trigger the tooltip

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 7 Sally 2021-03-12 15:17:11 UTC
Sorry, I keep jumping too soon - who knew that signing off bugs was so exciting?  ;)  

Happy to sign off again once it's ready for testing.
Comment 8 Owen Leonard 2021-03-15 19:00:59 UTC
I agree that we should update the templates to use the newer sorting option. I've updated the bug title to make it clear that it's about an obsolete option.
Comment 9 Jonathan Druart 2021-04-06 13:01:49 UTC
Still a couple of occurrences in waiting_holds.inc then we are good to remove the functions in datatables.js
Comment 10 Jonathan Druart 2021-04-06 13:15:20 UTC
Added a QA check

https://gitlab.com/koha-community/qa-test-tools/-/issues/48

    Issue #48 - Forbid title-string class for sorting
Comment 11 Fridolin Somers 2021-04-15 11:25:12 UTC
Recent push :
 Bug 27926: Add 'title-string' for dates on circ-patron-results

Does it need to be patched ?
Comment 12 Katrin Fischer 2021-04-17 18:05:55 UTC
(In reply to Fridolin Somers from comment #11)
> Recent push :
>  Bug 27926: Add 'title-string' for dates on circ-patron-results
> 
> Does it need to be patched ?

That already had a follow-up to fix it :)