Follow-up to #3021388: Table style update.

Problem/Motivation

We should update table-drag styles. We already have an initial idea/design on this Figma node, we just need two color for the row states.

Seven:
Table drag in Seven theme

Claro's text formats page design:
Table drag in Claro's Figma

Remaining tasks

  • UI design tasks
    • Choose a color from the palette for the dragging state.
    • Choose a color from the palette for the dragged-last state.
    • Verify that the drag handle used here is the final version
  • Patch

Comments

huzooka created an issue. See original summary.

andrewmacpherson’s picture

Thanks for filing this. There are some related core issues about improving the tabledrag behaviour. I don't think these are things to be solved in Claro, but it would be good if Claro assumes that they will

In particular, if the drag-handle button icon is redesigned, it will be good to include icon variants for the nested tree and up/down versions.

andrewmacpherson’s picture

Issue tags: +accessibitlity
ckrina’s picture

Component: Code » Needs design
brightbold’s picture

Assigned: Unassigned » brightbold
brightbold’s picture

Assigned: brightbold » Unassigned
bnjmnm’s picture

StatusFileSize
new1.06 MB
new15.01 KB

I had been working on #3023326: Field Cardinality Style Update and did not realize this issue existed as I was filtering my search by the 'code' component. Fortunately, most of the work I'd done on that issue is more pertinent to this one anyway. The attached patch pushes things forward and should be compatible with the pending designs. As noted in the screenshot filename, the menu UI is not yet ideal on mobile.

There is also JS that I strongly suspect will change - it copies tabledrag labels to their own table cell so the tabledrag handle and label can have consistent alignment. I'm pretty sure there's a nicer approach, but perhaps the approach in the fix will help expedite the better solution.

There's a little bit of styling that is specific to #3023326: Field Cardinality Style Update - it may be easiest to just update the IS to include those changes, but I'll let someone else be the final judge of that.

ckrina’s picture

Component: Needs design » Code
Issue tags: -Needs design

Choose a color from the palette for the dragging state.

Let's use the same from Seven for now.

Choose a color from the palette for the dragged-last state.

Let's use the same from Seven for now.

Verify that the drag handle used here is the final version

Yes, the one pointed is correct.

huzooka’s picture

Assigned: Unassigned » huzooka
huzooka’s picture

Assigned: huzooka » Unassigned
Status: Active » Needs review
StatusFileSize
new105.99 KB

Here we have the first patch.

Details:

  1. Instead of using the original size (24*24px) for the drag handle, I've increased its size to 25*25 pixels. This change makes it less blurry than by using the original dimensions.
  2. I had to replace the original JS with a customized one because I needed a theme function for the drag handle.
  3. An RTL user is (still) unable to properly manage the depth term with pointer (mouse/tap) events: This is because the calculation in dragRow() is wrong. Actually this happens by using the original JS with Seven as well.
huzooka’s picture

Assigned: Unassigned » huzooka
Status: Needs review » Needs work

Found an issue with Safari (handle is unfocusable).

huzooka’s picture

huzooka’s picture

huzooka’s picture

Assigned: huzooka » Unassigned
Status: Needs work » Needs review
StatusFileSize
new106.14 KB
new1.77 KB

The attached patch fixes #10.3 and #11.

lauriii’s picture

Issue tags: -accessibitlity +Accessibility
lauriii’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new78.59 KB
new8.94 KB
  1. +++ b/css/src/components/tabledrag.css
    @@ -1,12 +1,211 @@
    +  height: 0;
    ...
    +  height: 0.0625rem; /* 2. */
    

    Duplicate height property

  2. +++ b/css/src/components/tabledrag.css
    @@ -1,12 +1,211 @@
    +  margin-top: 0.125rem; /* 1. */
    

    It seems like 0.0625rem would work better for this since this is 1px too much.

  3. +++ b/css/src/components/tables.css
    @@ -144,7 +144,7 @@ td {
    -  min-height: 4rem;
    +  height: 4rem;
    

    Good catch. 👍

  4. +++ b/js/claro.tabledrag.es6.js
    @@ -0,0 +1,1715 @@
    + * @todo Remove after https://www.drupal.org/node/3024975 is in.
    

    We should link this to #3077938: Add a new Drupal.theme JavaScript function for tabledrag handle to allow themes customize the handle's markup.


  5. Maybe the focus could look more like this?
finnsky’s picture

Assigned: Unassigned » finnsky
finnsky’s picture

Assigned: finnsky » Unassigned
katrienc’s picture

Status: Needs work » Needs review
StatusFileSize
new106.11 KB

Patch with changes in #14

#16:
1. removed the duplicated height
2.

+++ b/css/src/components/tabledrag.css
@@ -1,12 +1,211 @@
+  margin-top: 0.125rem; /* 1. */

It seems like 0.0625rem would work better for this since this is 1px too much.

I also agree that 0.0625rem works better, I've added it to the patch

4. the borders around the handler should be a square (not a rectangle).
I changed the left and right in .tabledrag-handle:focus::before (tabledrag.css).

  • lauriii committed d3cb661 on 8.x-1.x
    Issue #3032365 by huzooka, bnjmnm, lot007, lauriii, ckrina: Table drag...
lauriii’s picture

Status: Needs review » Fixed

This looks great! Thank you @lot007! 👏

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.