Skip to content

NTNGL-5467 | Enable List Tile Drag and Drop#6973

Open
NicholasHallman wants to merge 30 commits into
mainfrom
NTNGL-5467/tile-mouse-drag-logic
Open

NTNGL-5467 | Enable List Tile Drag and Drop#6973
NicholasHallman wants to merge 30 commits into
mainfrom
NTNGL-5467/tile-mouse-drag-logic

Conversation

@NicholasHallman

@NicholasHallman NicholasHallman commented May 12, 2026

Copy link
Copy Markdown
Contributor

Almost entirely css changes to re-enable drag and keyboard arrangement functionality for tiles.

The rest of the css is for properly positioning the elements and rotating the marker

Functional Tests (Demo Manual QA)

  • Dragging an item to the left edge of the first card and dropping places the element at the front of the tile list
  • Dragging an item to the right edge of the last card and dropping places the element at the end of the list
  • Dragging an item to the left edge of a card in the middle of the list drops it to the left of the drop target
  • Dragging an item to the right edge of a card in the middle of the list drops it to the right of the drop target
  • The drag handle can be focused with the keyboard and splits into two arrows
  • The keyboard can be used to move cards
  • The screen reader properly reads out the new order of the card after moving.
  • Actions are clickable in the title bar
  • With href on or off the drag area extends to the width of the title bar
  • RTL, the marker is in the correct position
  • RTL, keyboard controls place card in the correct position (up, down, left, right, home and end)

Highlighting some design decisions we made in the meeting with Glen and Tayzia

  • The up and down arrows work fine for tiles
  • The screen reader announcements and position information is fine for tiles
  • If a tile is draggable it should always have the tile title header

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-6973/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@NicholasHallman NicholasHallman left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Descriptions for what some of this css is accomplishing

}

:host([layout="tile"]) .d2l-list-item-drag-bottom-marker {
right: calc(-0.9rem + 3px);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Lots of magic numbers here but to explain, the -0.9 rem is the gap between the cards and the 3px is half of the 6px that was previously used to center the markers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for spelling this out. I would not be adverse to putting this in a comment for "future-us". I am sure we'll be wondering how we arrived at this down the road.

Comment on lines +350 to +354
:host([layout="tile"]) .d2l-list-item-drag-drop-grid {
display: grid;
grid-template-rows: 100%;
grid-template-columns: 1rem 1fr 1fr 1rem;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This rotates the drop targets

Comment thread components/list/list-item-drag-drop-mixin.js Outdated
Comment thread components/list/list-item-generic-layout.js Outdated
Comment on lines +238 to 243
:host([layout="tile"]:not([is-draggable])) {
grid-template-columns:
[start outside-control-start] 0
[outside-control-end control-start] minmax(0, min-content)
[control-end actions-start] minmax(0, auto)
[actions-end end];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This varient ensures that the selection box is the left most item when the drag handle isn't present. There's a fun layout issue that prevents minmax(0, min-content) from ever equalling 0. My guess is that this is due to the content below the header spanning this column and so chrome assumes the column can't have a width of 0.

Comment thread components/list/list-item-mixin.js
@NicholasHallman NicholasHallman marked this pull request as ready for review May 13, 2026 15:39
@NicholasHallman NicholasHallman requested a review from a team as a code owner May 13, 2026 15:39
Comment thread components/list/list-item-drag-drop-mixin.js
Comment thread components/list/list-item-drag-drop-mixin.js Outdated
@NicholasHallman NicholasHallman requested a review from dbatiste May 26, 2026 15:59
Comment thread components/list/list-item-mixin.js Outdated
Comment thread components/list/list-item-placement-marker.js Outdated
Comment thread components/list/list-item-placement-marker.js Outdated
</template>
</d2l-demo-snippet>

<h1>Tile Drag and Drop</h1>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's just a demo page, but the demo page's h1 is rendered further above. I'd either either just render all h2s (updating the heading text to be tile specific), or I would restructure the headings for all the demos on this page to use h2s and h3s.

@NicholasHallman

Copy link
Copy Markdown
Contributor Author

Now with side to side move buttons!

LTR
side to side move button ltr

RTL
side to side move button rtl

NicholasHallman and others added 6 commits June 17, 2026 10:24
* Updating translations - Sync

* Updating translations - Sort

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…paceUI/core into NTNGL-5467/tile-mouse-drag-logic
Comment thread components/list/list-item-checkbox-mixin.js
Comment thread components/list/list-item-drag-handle.js Outdated
Comment thread components/list/list-item-drag-handle.js Outdated
@dbatiste

Copy link
Copy Markdown
Contributor

Now with side to side move buttons!

LTR side to side move button ltr side to side move button ltr

RTL side to side move button rtl side to side move button rtl

The white-space inside looks a little weird eh? Not sure what to do about that atm. I know it's the result of my suggestion of including the entire hit area in the layout, in effort to avoid any overlap with adjacent elements. 🤔

@NicholasHallman

Copy link
Copy Markdown
Contributor Author

The white-space inside looks a little weird eh? Not sure what to do about that atm. I know it's the result of my suggestion of including the entire hit area in the layout, in effort to avoid any overlap with adjacent elements. 🤔

Yeah I agree it is a bit much. One alternative would be to make the buttons 24x24 pixels so it's less awkward?

@dbatiste

Copy link
Copy Markdown
Contributor

The white-space inside looks a little weird eh? Not sure what to do about that atm. I know it's the result of my suggestion of including the entire hit area in the layout, in effort to avoid any overlap with adjacent elements. 🤔

Yeah I agree it is a bit much. One alternative would be to make the buttons 24x24 pixels so it's less awkward?

@glen-bartlett-d2l what do you think we should do here? Happy to hook up to discuss options.

@glen-bartlett-d2l

glen-bartlett-d2l commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

The white-space inside looks a little weird eh? Not sure what to do about that atm. I know it's the result of my suggestion of including the entire hit area in the layout, in effort to avoid any overlap with adjacent elements. 🤔

Yeah I agree it is a bit much. One alternative would be to make the buttons 24x24 pixels so it's less awkward?

@glen-bartlett-d2l what do you think we should do here? Happy to hook up to discuss options.

@dbatiste @NicholasHallman Yeah I think increasing the button size is the way to go. Here’s what it should look like, including the new measurements. I think we can also tighten up the space between the drag button / move button and the checkbox, we're been using 6px space for button spacing in the top bar

Screenshot 2026-06-19 at 11 17 19 AM Screenshot 2026-06-19 at 11 18 19 AM Screenshot 2026-06-19 at 11 18 28 AM Screenshot 2026-06-19 at 11 18 38 AM

@glen-bartlett-d2l

Copy link
Copy Markdown
Contributor

Now with side to side move buttons!

LTR side to side move button ltr side to side move button ltr

RTL side to side move button rtl side to side move button rtl

@NicholasHallman Not sure if this is just artifacts from the capture, but is there a small gap on the top and the right of the card between the background and the border?

Screenshot 2026-06-19 at 11 34 05 AM

@NicholasHallman

NicholasHallman commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@glen-bartlett-d2l That looks great I'll get right on it.

Also about the spacing, I noticed that too a bit ago. I believe that was happening before my changes but I'll take a closer look just to be sure. If it's unrelated I can take a look at fixing it as part of a seperate pr but otherwise I'll wrangle it here :)

@dbatiste

Copy link
Copy Markdown
Contributor

I think that's a separate thing. Not sure if it's just an artifact of the zoom and how the grid items are laid out. Would love a fix if you can solve it easily. Otherwise I will look into it / or create a ticket for us.

@NicholasHallman

Copy link
Copy Markdown
Contributor Author
tile-dnd-fixed-button-sizes

New bigger buttons! Also tightened up the margins so the spacing between the selection box and the drag handle is the same as the drag handle to the edge of the card.

I think that's a separate thing. Not sure if it's just an artifact of the zoom and how the grid items are laid out.

Took a peek, it's a pesky issue. The slotted content seems to overlay with the borders so some css is shrinking everything by 1px. When we have off layouts with subpixels (like the 800.4 px wide card above) you can see some white spacing.

@dbatiste

Copy link
Copy Markdown
Contributor

Took a peek, it's a pesky issue.

I was afraid that might be the case. 😢

NicholasHallman and others added 2 commits June 24, 2026 16:01
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants