Skip to content

Commit b86c8c8

Browse files
committed
fix(cdk/drag-drop): reset user agent color on preview popover
After #28945 the preview is inserted into a `popover` element which has a user agent styling of `color: canvastext`. These changes reset it to `inherit` to match the old behavior. Fixes #28974. (cherry picked from commit a3b3211)
1 parent c86359d commit b86c8c8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/cdk/drag-drop/directives/drag.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,6 +2515,15 @@ describe('CdkDrag', () => {
25152515
expect(previewContainer)
25162516
.withContext('Expected preview container to be in the DOM')
25172517
.toBeTruthy();
2518+
expect(previewContainer.style.color)
2519+
.withContext('Expected preview container to reset user agent color')
2520+
.toBe('inherit');
2521+
expect(previewContainer.style.margin)
2522+
.withContext('Expected preview container to reset user agent margin')
2523+
.toMatch(zeroPxRegex);
2524+
expect(previewContainer.style.padding)
2525+
.withContext('Expected preview container to reset user agent padding')
2526+
.toMatch(zeroPxRegex);
25182527
expect(preview.textContent!.trim())
25192528
.withContext('Expected preview content to match element')
25202529
.toContain('One');

src/cdk/drag-drop/preview-ref.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class PreviewRef {
121121
'pointer-events': 'none',
122122
'margin': '0',
123123
'padding': '0',
124+
'color': 'inherit',
124125
});
125126
toggleNativeDragInteractions(wrapper, false);
126127

0 commit comments

Comments
 (0)