Skip to content

Commit d3c5cb5

Browse files
committed
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 f62877d commit d3c5cb5

3 files changed

Lines changed: 29 additions & 4 deletions

File tree

browser/css/btns.css

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

156156
:not(.main-nav) .button-secondary,
157157
:not(.main-nav) .button-secondary:not(.arrowbackground),
158-
: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) {
158+
: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) {
159159
box-sizing: border-box;
160160
height: 32px;
161161
line-height: normal;

browser/css/jsdialogs.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,17 +1902,18 @@ img.context-menu-icon {
19021902
/* menu button */
19031903
.jsdialog.menubutton {
19041904
box-sizing: border-box;
1905+
height: 32px;
19051906
line-height: normal;
1906-
font-size: calc(var(--default-font-size)*1.2);
1907+
font-size: var(--default-font-size);
19071908
font-family: var(--cool-font);
19081909
border: 1px solid var(--color-border-dark);
19091910
border-radius: var(--border-radius);
1910-
padding: 8px 10px;
1911+
padding: 0 10px;
19111912
margin: 2px 0px;
19121913
background-color: var(--color-background-dark);
19131914
display: flex;
19141915
align-items: center;
1915-
justify-content: center;
1916+
justify-content: flex-start;
19161917
}
19171918

19181919
.jsdialog.menubutton img {
@@ -1944,6 +1945,10 @@ button.has-img img {
19441945
margin: 5px 0 0 5px;
19451946
}
19461947

1948+
.jsdialog.menubutton .arrow {
1949+
margin-inline-start: auto;
1950+
}
1951+
19471952
.jsdialog.menubutton[disabled] {
19481953
background-color: transparent !important;
19491954
color: var(--color-text-lighter) !important;

cypress_test/integration_tests/desktop/writer/spinfield_spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,26 @@ describe(['tagdesktop'], 'Spinfield unit and button tests', function () {
214214
});
215215
});
216216

217+
it('Menubutton and listbox-container left-align in grid', function () {
218+
openDialogAndSwitchToBorder();
219+
220+
// The Line section of the Border tab has a menubutton (#linestylelb)
221+
// and a listbox-container (#linewidthlb) in the same grid column.
222+
// They should share the same left edge.
223+
cy.cGet('#linestylelb').should('be.visible');
224+
cy.cGet('#linewidthlb').should('be.visible');
225+
226+
cy.cGet('#linestylelb').then(function ($btn) {
227+
var btnLeft = $btn[0].getBoundingClientRect().left;
228+
229+
cy.cGet('#linewidthlb').should(function ($list) {
230+
var listLeft = $list[0].getBoundingClientRect().left;
231+
expect(listLeft).to.equal(btnLeft);
232+
});
233+
});
234+
235+
});
236+
217237
it('Buttons enabled after re-enabling spinfield in columns dialog', function () {
218238
cy.then(function () {
219239
win.app.map.sendUnoCommand('.uno:FormatColumns');

0 commit comments

Comments
 (0)