Skip to content

Commit 9c509c0

Browse files
hjanuschkaDevtools-frontend LUCI CQ
authored andcommitted
Fix long CSS values being clipped in Styles pane
Add overflow-wrap: break-word to tree outline items and constrain the TextPrompt proxy span width during editing so long values wrap instead of being clipped by overflow: hidden. Bug: 431091918 Change-Id: I8d991b3720e21b619f1f62b99ba7611bd92b1668 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7644488 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Helmut Januschka <helmut@januschka.com> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
1 parent 41f3a68 commit 9c509c0

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

front_end/panels/elements/StylePropertyTreeElement.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,4 +2386,19 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
23862386
sinon.assert.calledOnce(editingEndedSpy);
23872387
});
23882388
});
2389+
2390+
it('applies overflow-wrap: break-word to tree outline list items for long values', () => {
2391+
// Create a very long value without spaces that would otherwise overflow.
2392+
const longValue = '9'.repeat(500) + 'px';
2393+
const stylePropertyTreeElement = getTreeElement('width', longValue);
2394+
const section = stylePropertyTreeElement.section();
2395+
section.propertiesTreeOutline.appendChild(stylePropertyTreeElement);
2396+
stylePropertyTreeElement.updateTitle();
2397+
renderElementIntoDOM(section.element);
2398+
2399+
const li = section.propertiesTreeOutline.shadowRoot.querySelector('.tree-outline li');
2400+
assert.exists(li);
2401+
const computedStyle = getComputedStyle(li);
2402+
assert.strictEqual(computedStyle.overflowWrap, 'break-word');
2403+
});
23892404
});

front_end/panels/elements/stylePropertiesTreeOutline.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
padding-left: 22px;
2222
white-space: normal;
2323
text-overflow: ellipsis;
24+
overflow-wrap: break-word;
2425
cursor: auto;
2526
display: block;
2627

@@ -74,6 +75,12 @@
7475
overflow-wrap: break-word !important; /* stylelint-disable-line declaration-no-important */
7576
white-space: normal !important; /* stylelint-disable-line declaration-no-important */
7677
padding-left: 0;
78+
79+
/* Constrain the TextPrompt proxy span (display: inline-block) so that
80+
long values wrap instead of overflowing the section. */
81+
> span:has(> .text-prompt-root) {
82+
max-width: 100%;
83+
}
7784
}
7885

7986
.info {

0 commit comments

Comments
 (0)