Skip to content

Commit ce51b33

Browse files
authored
Improve combobox dropdown styling to give labels more room and readability (#10127)
* Fields: Break long lines in combo dropdown instead of ellipsis Longer translations keys are not readable with ellipsis and the tooltip only shows the description (or fallback), not the title. This change makes long use line breaks with small line height to make the whole text visible. * Fields: Use table styles for rows to maximize available space The flex box solution gave a lot of space to the label. This solution minimizes that space to give more space to the values dropdown.
1 parent a2e1c59 commit ce51b33

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

css/80_app.css

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,11 +1585,11 @@ input.date-selector {
15851585
display: flex;
15861586
flex-flow: row nowrap;
15871587
}
1588-
.form-field ul.rows li.labeled-input > span,
15891588
.form-field ul.rows li.labeled-input > div {
15901589
flex: 1 1 auto;
15911590
width: 100%;
15921591
border-radius: 0;
1592+
line-height: 0.95rem;
15931593
}
15941594
.form-field ul.rows li input {
15951595
border-radius: 0;
@@ -1608,6 +1608,28 @@ input.date-selector {
16081608
border-right-width: 1px;
16091609
}
16101610

1611+
/* Field - lists with labeled input items as table
1612+
------------------------------------------------------- */
1613+
.form-field ul.rows.rows-table {
1614+
display: table;
1615+
width: 100%;
1616+
}
1617+
.form-field ul.rows.rows-table li.labeled-input {
1618+
display: table-row;
1619+
}
1620+
.form-field ul.rows.rows-table li.labeled-input > div:first-child {
1621+
display: table-cell;
1622+
width: auto;
1623+
max-width: 170px;
1624+
white-space: nowrap;
1625+
text-overflow: ellipsis;
1626+
overflow: hidden;
1627+
}
1628+
.form-field ul.rows.rows-table li.labeled-input > div:nth-child(2) {
1629+
display: table-cell;
1630+
width: auto;
1631+
}
1632+
16111633

16121634
/* Field - Structure
16131635
------------------------------------------------------- */
@@ -2354,9 +2376,8 @@ div.combobox {
23542376
display: block;
23552377
padding: 5px 10px;
23562378
border-top: 1px solid #ccc;
2357-
text-overflow: ellipsis;
2358-
white-space: nowrap;
2359-
overflow: hidden;
2379+
line-height: 0.95rem;
2380+
break: all;
23602381
}
23612382

23622383
.combobox a.selected,

modules/ui/fields/access.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function uiFieldAccess(field, context) {
3737
.attr('class', function(d) { return 'labeled-input preset-access-' + d; });
3838

3939
enter
40-
.append('span')
40+
.append('div')
4141
.attr('class', 'label preset-label-access')
4242
.attr('for', function(d) { return 'preset-input-access-' + d; })
4343
.html(function(d) { return field.t.html('types.' + d); });

modules/ui/fields/directional_combo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function uiFieldDirectionalCombo(field, context) {
4343

4444
div = div.enter()
4545
.append('ul')
46-
.attr('class', 'rows')
46+
.attr('class', 'rows rows-table')
4747
.merge(div);
4848

4949
items = div.selectAll('li')
@@ -54,7 +54,7 @@ export function uiFieldDirectionalCombo(field, context) {
5454
.attr('class', function(d) { return 'labeled-input preset-directionalcombo-' + stripcolon(d); });
5555

5656
enter
57-
.append('span')
57+
.append('div')
5858
.attr('class', 'label preset-label-directionalcombo')
5959
.attr('for', function(d) { return 'preset-input-directionalcombo-' + stripcolon(d); })
6060
.html(function(d) { return field.t.html('types.' + d); });

modules/ui/fields/radio.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function uiFieldRadio(field, context) {
127127
.attr('class', 'labeled-input structure-type-item');
128128

129129
typeEnter
130-
.append('span')
130+
.append('div')
131131
.attr('class', 'label structure-label-type')
132132
.attr('for', 'preset-input-' + selected)
133133
.call(t.append('inspector.radio.structure.type'));
@@ -172,7 +172,7 @@ export function uiFieldRadio(field, context) {
172172
.attr('class', 'labeled-input structure-layer-item');
173173

174174
layerEnter
175-
.append('span')
175+
.append('div')
176176
.attr('class', 'label structure-label-layer')
177177
.attr('for', 'preset-input-layer')
178178
.call(t.append('inspector.radio.structure.layer'));

0 commit comments

Comments
 (0)