Skip to content

Commit a03a47c

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 8e3dfd2 commit a03a47c

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
@@ -2508,6 +2508,15 @@ describe('CdkDrag', () => {
25082508
expect(previewContainer)
25092509
.withContext('Expected preview container to be in the DOM')
25102510
.toBeTruthy();
2511+
expect(previewContainer.style.color)
2512+
.withContext('Expected preview container to reset user agent color')
2513+
.toBe('inherit');
2514+
expect(previewContainer.style.margin)
2515+
.withContext('Expected preview container to reset user agent margin')
2516+
.toMatch(zeroPxRegex);
2517+
expect(previewContainer.style.padding)
2518+
.withContext('Expected preview container to reset user agent padding')
2519+
.toMatch(zeroPxRegex);
25112520
expect(preview.textContent!.trim())
25122521
.withContext('Expected preview content to match element')
25132522
.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)