Skip to content

Commit 6e19d5c

Browse files
szuendDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[icon] Fix SoftContextMenu alignment regression
The CL https://crrev.com/c/4422328 changed the icon implementation in the SoftContextMenu to <devtools-icon>. This broke alignment when the menu item text was long enough to cause the menu to grow. The root cause is that <devtools-icon> when hidden, reports a width of 0, throwing off the size calculations. This CL fixes this by setting `min-width` on the hidden checkmark icon. [email protected] Bug: 1427397 Change-Id: I785494e775bf5a8b2679ab1092dae682dafb4178 Fixed: 1434260 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4445937 Commit-Queue: Simon Zünd <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]>
1 parent 8ea4f69 commit 6e19d5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

front_end/ui/legacy/SoftContextMenu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ export class SoftContextMenu {
219219
const checkMarkElement = new IconButton.Icon.Icon();
220220
checkMarkElement.data = {iconName: 'checkmark', color: 'var(--icon-default)', width: '14px', height: '14px'};
221221
checkMarkElement.classList.add('checkmark');
222+
checkMarkElement.style.minWidth =
223+
'14px'; // <devtools-icon> collapses to 0 width otherwise, throwing off alignment.
222224
menuItemElement.appendChild(checkMarkElement);
223225
if (!item.checked) {
224226
checkMarkElement.style.opacity = '0';
@@ -301,6 +303,8 @@ export class SoftContextMenu {
301303
checkMarkElement.data = {iconName: 'checkmark', color: 'var(--icon-default)', width: '14px', height: '14px'};
302304
checkMarkElement.classList.add('checkmark', 'soft-context-menu-item-checkmark');
303305
menuItemElement.appendChild(checkMarkElement);
306+
checkMarkElement.style.minWidth =
307+
'14px'; // <devtools-icon> collapses to 0 width otherwise, throwing off alignment.
304308
checkMarkElement.style.opacity = '0';
305309

306310
createTextChild(menuItemElement, item.label || '');

0 commit comments

Comments
 (0)