Skip to content

Commit 7ccfce2

Browse files
caolanmpedropintosilva
authored andcommitted
jsdialog: fix menubutton alignment with other controls in grids
The broad button selector in btns.css matched jsdialog menubuttons, overriding their margin and width. This caused menubuttons to be offset by 5px from comboboxes and listboxes in the same grid column, since those are div elements that do not match the btns.css selector. Exclude .menubutton from the btns.css catch-all so menubuttons only get their jsdialogs.css styling. Also fix the menubutton rule to use the standard control height (32px), font size, and padding to match other controls, start-align the content, and push the dropdown arrow to the end of the button. Add a regression test that asserts the menubutton and listbox-container share the same left edge in the Border tab of the Character dialog. Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: I3ca1a8c46f905f849d08d087f79ad940d8e2ee57
1 parent 8b2691b commit 7ccfce2

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

browser/css/btns.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ button.jsdialog[disabled] img {
156156

157157
:not(.main-nav) .button-secondary,
158158
:not(.main-nav) .button-secondary:not(.arrowbackground),
159-
:not(.main-nav) > div:not(.toolbox) > button:not(.ui-tab):not(.ui-expander-btn):not(.ui-corner-all):not(.button-primary):not(.unobutton):not(.form-field-button):not(.col):not(.arrowbackground):not(.ui-combobox-button):not(.ui-linkbutton):not(.spinfieldbutton-up):not(.spinfieldbutton-down):not(.ui-treeview-header-button) {
159+
:not(.main-nav) > div:not(.toolbox) > button:not(.ui-tab):not(.ui-expander-btn):not(.ui-corner-all):not(.button-primary):not(.unobutton):not(.form-field-button):not(.col):not(.arrowbackground):not(.ui-combobox-button):not(.ui-linkbutton):not(.spinfieldbutton-up):not(.spinfieldbutton-down):not(.menubutton):not(.ui-treeview-header-button) {
160160
box-sizing: border-box;
161161
height: 32px;
162162
line-height: normal;

browser/css/jsdialogs.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,17 +1969,18 @@ img.context-menu-icon {
19691969
/* menu button */
19701970
.jsdialog.menubutton {
19711971
box-sizing: border-box;
1972+
height: 32px;
19721973
line-height: normal;
1973-
font-size: calc(var(--default-font-size)*1.2);
1974+
font-size: var(--default-font-size);
19741975
font-family: var(--cool-font);
19751976
border: 1px solid var(--color-border-dark);
19761977
border-radius: var(--border-radius);
1977-
padding: 8px 10px;
1978+
padding: 0 10px;
19781979
margin: 2px 0px;
19791980
background-color: var(--color-background-dark);
19801981
display: flex;
19811982
align-items: center;
1982-
justify-content: center;
1983+
justify-content: flex-start;
19831984
}
19841985

19851986
.jsdialog.menubutton img {
@@ -2011,6 +2012,10 @@ button.has-img img {
20112012
margin: 5px 0 0 5px;
20122013
}
20132014

2015+
.jsdialog.menubutton .arrow {
2016+
margin-inline-start: auto;
2017+
}
2018+
20142019
.jsdialog.menubutton[disabled] {
20152020
background-color: transparent !important;
20162021
color: var(--color-text-lighter) !important;

cypress_test/integration_tests/desktop/writer/spinfield_spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,23 @@ describe(['tagdesktop'], 'Spinfield unit and button tests', function () {
288288
});
289289
});
290290
});
291+
292+
it('Menubutton and listbox-container left-align in grid', function () {
293+
openDialogAndSwitchToBorder();
294+
295+
// The Line section of the Border tab has a menubutton (#linestylelb)
296+
// and a listbox-container (#linewidthlb) in the same grid column.
297+
// They should share the same left edge.
298+
cy.cGet('#linestylelb').should('be.visible');
299+
cy.cGet('#linewidthlb').should('be.visible');
300+
301+
cy.cGet('#linestylelb').then(function ($btn) {
302+
var btnLeft = $btn[0].getBoundingClientRect().left;
303+
304+
cy.cGet('#linewidthlb').should(function ($list) {
305+
var listLeft = $list[0].getBoundingClientRect().left;
306+
expect(listLeft).to.equal(btnLeft);
307+
});
308+
});
309+
});
291310
});

0 commit comments

Comments
 (0)