Skip to content

Commit 9bba79c

Browse files
committed
Improve styling of handle-less BorderBox rows
1 parent 676e61d commit 9bba79c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

frontend/src/global_styles/primer/_overrides.sass

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ ul.SegmentedControl,
156156
.ActionListItem-label[class^="__hl_"], .ActionListItem-label[class*=" __hl_"]
157157
color: var(--control-fgColor-disabled) !important
158158

159+
// hide hover when dragging with legacy Dragula implementation
160+
.Box-row--hover-gray,
161+
.Box-row--hover-blue
162+
body[data-dragging="active"] &
163+
background-color: unset
164+
159165
.Box-row--focus-gray
160166
&:focus-visible
161167
background-color: var(--bgColor-muted)
@@ -170,6 +176,19 @@ ul.SegmentedControl,
170176
.Box-row--draggable:not(.Box-row--clickable)
171177
cursor: grab
172178

179+
.Box-row--draggable
180+
&[data-dragging="mirror"]
181+
background-color: var(--bgColor-default)
182+
border: var(--borderWidth-default) solid var(--borderColor-default)
183+
border-radius: var(--borderRadius-medium)
184+
box-shadow: var(--shadow-floating-medium)
185+
opacity: 1
186+
187+
&[data-dragging="source"]
188+
opacity: 0.4
189+
background-color: var(--bgColor-subtle)
190+
box-shadow: inset 0 0 0 var(--borderWidth-default) var(--borderColor-muted)
191+
173192
// Apply the mobile styles as soon as the banner itself is small
174193
// Styles are copied from the PVC repo
175194
.op-primer-flash

frontend/src/stimulus/controllers/dynamic/generic-drag-and-drop.controller.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,19 @@ export default class GenericDragAndDropController extends Controller {
129129
mirrorContainer: this.resolveMirrorContainer(),
130130
},
131131
)
132+
.on('cloned', (clone, _original, type) => {
133+
clone.setAttribute('data-dragging', type);
134+
})
132135
.on('drag', (el, source) => {
133136
this.dragOriginSource = source;
134137
this.dragOriginNextSibling = el.nextElementSibling;
135138

139+
el.setAttribute('data-dragging', 'source');
136140
document.body.setAttribute('data-dragging', 'active');
137141
this.ariaPressedTarget(el)?.setAttribute('aria-pressed', 'true');
138142
})
139143
.on('dragend', (el) => {
144+
el.removeAttribute('data-dragging');
140145
document.body.removeAttribute('data-dragging');
141146
this.ariaPressedTarget(el)?.setAttribute('aria-pressed', 'false');
142147
})

0 commit comments

Comments
 (0)